Skip to content

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.

@BurntSushi BurntSushi mentioned this pull request Aug 23, 2025
@typetetris
Copy link

Having a function like memory_usage_estimate for the exact same reason of having a size based cache would be very helpful to me, too.

At the moment I use regex-automata directly for that purpose and need to copy some stuff from the regex crate.

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.

5 participants