demo-redis-python-lua:如何在 Python 中使用 Redis+Lua

时间:2021-06-28 01:38:01
【文件属性】:
文件名称:demo-redis-python-lua:如何在 Python 中使用 Redis+Lua
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-28 01:38:01
Python 这是一个小演示,展示了如何使用 Python 中的 Redis 和 Lua 将性能提高至少 3 倍。 当您在 Redis 之上创建自定义数据结构时,这是推荐的优化策略。 一个简单的 incr 命令的基准测试 我已经在 Python 和 Python+Lua 中重新实现了incr 。 您可以在下方看到 300.000 个 incr 命令的基准测试。 Lua 版本的性能提高了大约 3 倍。 两个版本都支持诸如原子性之类的好东西。 在 Python 中实现的增量(约 37.7 秒执行) time python test_incr_python.py 300000 python test_incr_python.py 300000 37.77s user 12.00s system 73% cpu 1:07.73 total 在 Lua 中实现的增量(约 10.7 秒执行) time
【文件预览】:
demo-redis-python-lua-master
----incr_example()
--------__init__.py(1KB)
--------lua()
----LICENSE(1KB)
----test_incr_lua.py(328B)
----README.md(828B)
----.gitignore(675B)
----test_incr_python.py(331B)

网友评论