-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
I had an idea:
- using a smart string searching algorithm like boyer-moore, would likely speed up all the applications that use string matching in the std lib.
I assume it'd be possible for byte arrays to use the same algorithm and not just strings, to get a comparable speedup. - A related idea is data structures that abstract an algorithm. for example, instead of reversing an array, make a structure that holds this array, and its length, and computes the correct index, as if the array was reversed. 0 would be len-1, 3 would be len -4, -1 would be 0, -2 would be 1.
something like:
proc calc(pos:int) = len + (i * -1) -1
There might be other use cases, such as a slice, which is a certain "window" to the underlying sequence.
What do you guys think?