You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
evaluate using cattrs + orjson instead of custom serialization/deserialization
seems like as of cachew v0.13.0, on test_many, cattrs + orjson is
- 31% faster for writing
- 17% faster for reading
Note that this includes other overhead like writing to the DB, so actual serialization/deserialization is even faster than that
performance stats:
original version:
```
src/cachew/tests/test_cachew.py::test_many[1000000-False] [INFO 2023-09-10 23:22:55,188 cachew __init__.py:1141] cachew.tests.test_cachew:test_many.<locals>.iter_data: wrote 1000000 objects to cachew (sqlite /tmp/pytest-of-adhoc/pytest-74/test_many_1000000_False_0/test_many)
test_many: initial write to cache took 7.2s
test_many: cache size is 23.06048Mb
[INFO 2023-09-10 23:22:55,306 cachew __init__.py:1005] cachew.tests.test_cachew:test_many.<locals>.iter_data: loading 1000000 objects from cachew (sqlite /tmp/pytest-of-adhoc/pytest-74/test_many_1000000_False_0/test_many)
test_many: reading from cache took 3.7s
[INFO 2023-09-10 23:22:58,995 cachew __init__.py:1005] cachew.tests.test_cachew:test_many.<locals>.iter_data: loading 1000000 objects from cachew (sqlite /tmp/pytest-of-adhoc/pytest-74/test_many_1000000_False_0/test_many)
PASSED
```
with cattrs + orjson
```
src/cachew/tests/test_cachew.py::test_many[1000000-False] [INFO 2023-09-10 23:23:35,704 cachew __init__.py:1055] cachew.tests.test_cachew:test_many.<locals>.iter_data: wrote 1000000 objects to cachew (sqlite /tmp/pytest-of-adhoc/pytest-75/test_many_1000000_False_0/test_many)
test_many: initial write to cache took 4.9s
test_many: cache size is 72.904704Mb
[INFO 2023-09-10 23:23:36,048 cachew __init__.py:916 ] cachew.tests.test_cachew:test_many.<locals>.iter_data: loading 1000000 objects from cachew (sqlite /tmp/pytest-of-adhoc/pytest-75/test_many_1000000_False_0/test_many)
test_many: reading from cache took 3.1s
[INFO 2023-09-10 23:23:39,114 cachew __init__.py:916 ] cachew.tests.test_cachew:test_many.<locals>.iter_data: loading 1000000 objects from cachew (sqlite /tmp/pytest-of-adhoc/pytest-75/test_many_1000000_False_0/test_many)
PASSED
```
This will break many other things at the moment though, so can't use it straightaway
0 commit comments