V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
chuangbo
V2EX  ›  Python

没想到 zipfile 这么快,用 python 写的 key-value 数据库,核心代码 20 行,封装了 zipfile,每秒插入读取 8000 次左右

  •  
  •   chuangbo · 2012-06-19 17:57:06 +08:00 · 4178 次点击
    这是一个创建于 4300 天前的主题,其中的信息可能已经有所发展或是发生改变。

    数据存在 zip 压缩包里,文件名为 key,内容是 value,每个操作都落地,简单的难以想象。
    4 条回复    1970-01-01 08:00:00 +08:00
    chuangbo
        1
    chuangbo  
    OP
       2012-06-19 17:58:00 +08:00
    咦,gist 不会自动转换了吗?
    lyxint
        2
    lyxint  
       2012-06-19 20:59:17 +08:00   ❤️ 1
    zipdb对一个key多次写入不是覆盖而是追加, 且不能删除k/v对, 因为不支持__delitem__
    benchmark下来还是比semidbm差很多, 见 http://dpaste.com/761151/
    当然比代码少zipdb赢了
    xinkiang
        3
    xinkiang  
       2012-06-19 21:02:03 +08:00
    @chuangbo 去掉https的s
    Kai
        4
    Kai  
    MOD
       2012-06-19 21:08:53 +08:00
    @xinkiang @chuangbo 调整了一下 :)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   952 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 21:40 · PVG 05:40 · LAX 14:40 · JFK 17:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.