rlocate/crates/squozen/bench
Elf M. Sternberg d13a76f08a Make prepare_pattern more Rust-like.
This just removes the layer between `prepare_pattern` and
`prepare_pattern_raw`; the function now always returns the
allocated vector.

Oddly, it wasn't possible to encode this using an Option<> in the
`hunt()` function.  The `usize` of the scan variable meant that we'd
never go below zero legally (and Rust wouldn't let that happen), so
the "if we're at zero we have some special cases to check" had to
remain here.  The C version of this code could say "If this pointer
is below the allocated space" which is, to a Rust developer, hella
weird (you're literally pointed at memory you don't own!).

And despite the allocation, despite the special case checks, this code
is *still* twice as fast as its C implementation.
2022-11-24 12:56:13 -08:00
..
bench_patprep.rs Make prepare_pattern more Rust-like. 2022-11-24 12:56:13 -08:00