Skip to content

Pythonic optimizations (msgspec and lru_cache) - #64

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

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.

@mkhazraee
mkhazraee marked this pull request as draft October 3, 2026 09:27
Signed-off-by: Moein Khazraee <moein@nvidia.com>
@mkhazraee

Copy link
Copy Markdown
Collaborator Author

msgspec conversions and much of the metadata caching are now covered by main; remaining layout caches lack a demonstrated benefit.

@mkhazraee mkhazraee closed this Oct 16, 2026
@mkhazraee
mkhazraee deleted the moein/python_opts branch October 16, 2026 05:00
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