cache the Range for gen_ascii_chars#171
Conversation
could even use `unsafe fn get_unchecked`.
range for gen_ascii_charsRange for gen_ascii_chars
|
Just an optimisation? This may get removed anyway (check my branch/PR). |
|
Will this function/feature be moved elsewhere? If not, I think archiving a more optimal version somewhere is still a good idea. |
|
Sorry, @TheIronBorn. I'm not quite sure what will happen; I have an experimental refactor of quite a lot of You might be able to apply the same optimisation here. Note that TODO comment and the note in the refactor RFC; some more tweaks to this (e.g. other character classes) are possible (please open a PR or comment on the RFC if you have suggestions):
|
|
In dhardy#69 I have an other solution that does not need caching, and is about 4,5 times faster than the current version. And no unsafe indexing necessary: the range check needed to ensure a uniform range doubles as a bounds check. @TheIronBorn Sorry for working on the same thing. |
|
Great, lets go for the second version then. |
could even use
unsafe fn get_unchecked.