Skip to content

Pythonic optimizations (msgspec and lru_cache) - #64

Draft
mkhazraee wants to merge 1 commit into
mainfrom
moein/python_opts
Draft

mkhazraee wants to merge 1 commit into
mainfrom
moein/python_opts

Conversation

@mkhazraee

@mkhazraee mkhazraee commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Reduce Python overhead in KVCR’s transfer and allocation paths:

  • Replace RegionDescriptor, MemoryRef, and _TransferRef dataclasses with msgspec.Struct.
  • Add bounded LRU caches for layout matching and per-pool slot counts.

Caching avoids repeating layout calculations but retains some memory and still requires tuple construction and hashing on cache hits. The net performance benefit has not been benchmarked.

Signed-off-by: Moein Khazraee <moein@nvidia.com>
@mkhazraee
mkhazraee marked this pull request as draft October 3, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant