6 ms·
It is interesting to note how it compares to "choose" (also in Rust) in the benchmarks. single character hck 1.494 ± 0.026s hck (no-mmap) 1.
by bilalhusain 5y ago
It is interesting to note how it compares to "choose" (also in Rust) in the benchmarks.
single character
hck 1.494 ± 0.026s
hck (no-mmap) 1.735 ± 0.004s
choose 4.597 ± 0.016s
multi character
hck 2.127 ± 0.004s
hck (no-mmap) 2.467 ± 0.012s
choose 3.266 ± 0.011s
The single pass optimization trick[1] seems to be helping a lot in single character case.
Of course, doing away with a pass is suppossed to give 2x, and I am wondering whether the regex constraint lead to this "side-effect".
[1] fast mode - https://github.com/sstadick/hck/blob/master/src/lib/core.rs#L194 https://github.com/sstadick/hck/blob/master/src/lib/core.rs#...
https://github.com/sstadick/hck/blob/master/src/lib/core.rs#L324-L331 https://github.com/sstadick/hck/blob/master/src/lib/core.rs#...