3 ms·
> To fix this, regex crate must be updated or replaced. I somehow doubt pcre2 is being changed to make the tiny toy C programs run better. > I spent two weeke
by igouy 8y ago
> To fix this, regex crate must be updated or replaced.
I somehow doubt pcre2 is being changed to make the tiny toy C programs run better.
> I spent two weekends on this.
So shouldn't we assume the program performance simply reflects all-those-hours you've spent working on it?
- v_lisivka 8y agoLook at the program: fn find_replaced_sequence_length(sequence: String) -> usize { // Replace the following patterns, one at a time: let substs = vec![ ("tHa[Nt]", "<4>"), ("aND|caN|Ha[DS]|WaS", "<3>"), ("a[NSt]|BY", "<2>"), ("<[^>]*>", "|"), ("\\|[^|][^|]*\\|", "-"), ]; // Perform the replacements in the sequence: substs .iter() .fold(sequence, |s, (re, replacement)| { regex(re) .replace_all(&s, NoExpand(replacement)).into_owned() }).len() } It measures performance of RE engine. I can switch from regex crate to PCRE2, and program performance will match C.
- igouy 8y ago> I can switch from regex crate to PCRE2, and program performance will match C. Perhaps it would; those measurements have not been made. What does that have to do with re-writing libraries to make tiny toy programs run better? What does that have to do with program performance being a proxy for programmer effort?