Why is SQLite faster than Redis in this simple benchmark?

前端 未结 4 930
予麋鹿
予麋鹿 2021-01-30 17:16

I have done simple performance test on my local machine, this is python script:

import redis
import sqlite3
import time

data = {}
N = 100000

for i in xrange(N)         


        
4条回答
  •  花落未央
    2021-01-30 17:53

    SQLite is very fast, and you're only requiring one IO action (on the commit). Redis is doing significantly more IO since it's over the network. A more apples-to-apples comparison would involve a relational database accessed over a network (like MySQL or PostgreSQL).

    You should also keep in mind that SQLite has been around for a long time and is very highly optimized. It's limited by ACID compliance, but you can actually turn that off (as some NoSQL solutions do), and get it even faster.

提交回复
热议问题