Skip to content

Wrap correctionlib._core.CorrectionSet.from_string with an LRU cache - #349

Open
ikrommyd wants to merge 1 commit into
cms-nanoAOD:masterfrom
ikrommyd:from-string-caching
Open

Wrap correctionlib._core.CorrectionSet.from_string with an LRU cache#349
ikrommyd wants to merge 1 commit into
cms-nanoAOD:masterfrom
ikrommyd:from-string-caching

Conversation

@ikrommyd

Copy link
Copy Markdown
Contributor

Closes #347

This removed millions of allocations from HiggsDNA without even the systematics loop.

Signed-off-by: Iason Krommydas <iason.krom@gmail.com>
@ikrommyd ikrommyd changed the title wrap correctionlib._core.CorrectionSet.from_string with an LRU cache Wrap correctionlib._core.CorrectionSet.from_string with an LRU cache Jun 17, 2026
return iter(self._base)


@lru_cache(maxsize=64)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty large size, which would increase the memory usage of the process a bit depending on the size of the correction set (some are 10s MB)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the typical size of those strings? I thought they would be in the kBs so I thought 64 would be fine. What number would you suggest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Cache corrections

2 participants