theine icon indicating copy to clipboard operation
theine copied to clipboard

Theine V2

Open Yiling-J opened this issue 1 year ago • 2 comments

https://github.com/Yiling-J/theine/tree/v2

https://github.com/Yiling-J/theine/pull/30

Yiling-J avatar Aug 16 '24 06:08 Yiling-J

related branches: theine-core: https://github.com/Yiling-J/theine-core/tree/v2 theine: https://github.com/Yiling-J/theine/tree/v2

Changes(WIP):

  • Remove policy param from Cache, there is only one policy tlfu now.
  • Use sharded dict with lock for data storage.
  • Striped read buffer.
  • Use object hash() instead of auto increasing key.
  • Rewrite Rust core, use u64 as key.
  • Use asyncio for proactively expire, now all cache instances will use same event loop for maintance task.
  • The lock param of decorator will be removed, Theine will always use synchronization primitive to avoid thundering herd problem.

Yiling-J avatar Aug 26 '24 09:08 Yiling-J

Related issues:

  1. https://github.com/PyO3/pyo3/issues/4265#issuecomment-2318686408
    I attempted to build without the GIL, and it seems to work.

  2. https://github.com/python/cpython/issues/123619
    The instance method has high contention, making it slow. This should be fixed before running scalability benchmarks.

  3. https://github.com/Yiling-J/theine/pull/27
    The refactor/rewrite is based on this PR, which should be merged first.

Yiling-J avatar Sep 05 '24 07:09 Yiling-J