{"id":13501605,"url":"https://github.com/boramalper/pydis","last_synced_at":"2025-03-29T09:30:55.967Z","repository":{"id":56305070,"uuid":"172963262","full_name":"boramalper/pydis","owner":"boramalper","description":"A redis clone in Python 3 to disprove some falsehoods about performance.","archived":true,"fork":false,"pushed_at":"2020-11-15T18:03:06.000Z","size":41,"stargazers_count":636,"open_issues_count":6,"forks_count":46,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-10-31T20:40:35.575Z","etag":null,"topics":["clone","experiment","optimization","performance","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boramalper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-27T17:55:03.000Z","updated_at":"2024-10-20T11:12:01.000Z","dependencies_parsed_at":"2022-08-15T16:20:37.862Z","dependency_job_id":null,"html_url":"https://github.com/boramalper/pydis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boramalper%2Fpydis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boramalper%2Fpydis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boramalper%2Fpydis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boramalper%2Fpydis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boramalper","download_url":"https://codeload.github.com/boramalper/pydis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246167045,"owners_count":20734377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clone","experiment","optimization","performance","redis"],"created_at":"2024-07-31T22:01:43.341Z","updated_at":"2025-03-29T09:30:55.688Z","avatar_url":"https://github.com/boramalper.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# pydis\n**pydis** is an experiment to disprove some of the falsehoods about performance\nand optimisation regarding software and interpreted languages in particular.\n\nBelow you will find a [Redis](https://github.com/antirez/redis/) clone,\n**pydis**, written *in ~250 lines of idiomatic Python code*, providing a\nsubset of redis' functionality for which there are\n[official benchmarks](https://redis.io/topics/benchmarks).\n\nBriefly, **pydis** is ~50% as fast as Redis measured in number operations per\nsecond.\n\nP.S. This is not a criticism of Redis, which is a brilliant project and a \nsystem-level software that powers thousands of infrastructures. It just happened\nto be one of the fastest software I could imagine *and* clone the same day.\n\n## Disclaimer\nI have used the following libraries written in C for performance:\n\n- [uvloop](https://github.com/MagicStack/uvloop)\n\n  \u003e uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is implemented in Cython and uses libuv under the hood.\n                                                    \u003e\n- [hiredis](https://pypi.org/project/hiredis/)\n\n  \u003e Python extension that wraps protocol parsing code in hiredis.\n\n## Discussion\n- Hacker News\n  1. 2020-11-15 -- [Pydis – Redis clone in 250 lines of Python, for performance comparison ](https://news.ycombinator.com/item?id=25100218)\n  1. 2019-03-02 -- [Pydis: Redis clone in Python 3 to make points about performance](https://news.ycombinator.com/item?id=19287717)\n  \n\n- Reddit\n  1. 2019-03-01 -- [pydis - A redis clone in Python 3 to disprove some falsehoods about performance](https://www.reddit.com/r/Python/comments/awav6k/pydis_a_redis_clone_in_python_3_to_disprove_some/) \n  \n## Results\n```bash\nredis-benchmark -q -t set,get,incr,lpush,rpush,lpop,rpop,sadd,hset,spop,lrange,mset -n 100000 -P 5 \n```\n\n  - 100,000 requests in total per command.\n  - Requests are pipelined in groups of 5.\n\n\u003ccenter\u003e\n  \u003cimg src=\"plot.svg\" alt=\"The Bar Graph\"\u003e\n\u003c/center\u003e\n\nBenchmark | pydis | redis | Ratio\n--- | ---: | ---: | ---\nSET | 271,947 | 467,361 | 0.582\nGET | 274,283 | 467,237 | 0.587\nINCR | 213,409 | 478,669 | 0.446\nLPUSH | 216,082 | 381,033 | 0.567\nRPUSH | 231,143 | 399,238 | 0.579\nLPOP | 248,527 | 384,332 | 0.647\nRPOP | 241,144 | 429,971 | 0.561\nSADD | 219,475 | 434,257 | 0.505\nHSET | 220,178 | 377,637 | 0.583\nSPOP | 288,068 | 477,705 | 0.603\nLRANGE (100) | 26,170 | 96,254 | 0.272\nLRANGE (300) | 9,163 | 24,768 | 0.370\nLRANGE (500) | 5,771 | 19,351 | 0.298\nLRANGE (600) | 4,705 | 13,869 | 0.339\nMSET | 125,215 | 195,121 | 0.642\n\n### Host System\n- Ubuntu 20.04\n- Python 3.8.5 (GCC 9.3.0)\n- Redis 5.0.7 `malloc=jemalloc-5.2.1 bits=64 build=636cde3b5c7a3923`\n\n## Contributions\nContributions are very welcome, given that they fall into one of the following\ncategories:\n\n- Those that improve the performance.\n  - The aim of this exercise is to prove that interpreted languages can be just\n    as fast as C. So whilst using a faster parser in C with Python bindings is\n    okay, rewriting **pydis** in [Cython](https://cython.org/) is not.\n  - I will accept \"minor\" deviations from idioms only if the performance gains\n    are worth it; stick to idiomatic Python otherwise!\n- Those to achieve feature parity with Redis *for which there are official\n  benchmarks*.\n  - We are not trying to develop a full-featured Redis clone here so please do \n    not implement commands for which there are no official benchmarks.\n- Those that fix formatting etc.\n  - Please do not invent your own style, use PEP 8.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboramalper%2Fpydis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboramalper%2Fpydis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboramalper%2Fpydis/lists"}