Caching
Opened this issue · 1 comments
algebraic-dev commented
The rust regex library uses caching for improving a little bit the performance. I think that we could add something for it.
pandaman64 commented
For those who are interested in shaving off unnecessary allocations:
- NFA.captureNext discards the sparse sets and
saveSlots
every time it's called, which can be reused across the calls - Also, I think it's initSave reallocates an empty array due to the dependency on
saveSize
. We should allocate it once for onecaptureNext
call (ideally once for each size). - (Difficult) I believe
Option Pos
incurs a heap allocation. Since the string length is bounded in practice, we can embed.none
intoPos
and just useusize
under the food.
I'd recommend #11 first though so that we have a benchmark to measure the effect of the optimizations.