Some greps can indeed be quite good. 

Really, I think this algorithmic intelligence should be able to be just used 
from Nim `strutils`. Nim strings know their length. Many/most of those 
read-only procs like `strutils.find` "should" be able to work on types like 
`MemSlice` or really some kind of `openarray[char]` \-- a pointer and length 
pair. Scare quotes for the "should" since the current Nim `openarray` does not 
include arrays of dynamic/run-time extent but with non-heap/GC backing memory 
like a memory map, or some other blob of memory.

There is ongoing work on concepts that could probably profitably replace 
`openarray` in many use cases. So, maybe some day in the not too distant 
future, as they say. Concept support may already be good enough to start an 
ambitious project along those lines, but yeah, for you/your situation, just 
re-doing memSlices is a fine approach, esp. if absolute performance is not a 
priority.

Reply via email to