Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Regex memory usage info (fixes #943) #1180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

spektom
Copy link

@spektom spektom commented Apr 5, 2024

No description provided.

@Ambyjkl
Copy link

Ambyjkl commented Aug 29, 2024

@BurntSushi sorry for the ping but I wanted to bring your attention to this PR, it would be great if this could get merged

@Ambyjkl
Copy link

Ambyjkl commented Aug 29, 2024

@spektom can you also expose the function on RegexSet?

@BurntSushi
Copy link
Member

I have concerns about this that I explained in #943. Those need to be resolved first.

@Ambyjkl
Copy link

Ambyjkl commented Aug 29, 2024

I have concerns about this that I explained in #943. Those need to be resolved first.

That's fair, maybe a better name would be memory_usage_estimate with some warnings about potential caveats. My use case doesn't need precise figures, I want to use this memory usage estimate as weights in a weighted cache, so all I need is the ratio of memory usage between two regexes, not an absolute value.

@LuisDuarte1
Copy link

I have almost the same usecase as @Ambyjkl - I basically want a "LRU cache" of regex rules as I'm in a semi-constrained memory environment. In my opinion, calling it memory_usage_estimate is more than good enough providing we document it properly.

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.

4 participants