Regex slower than in python (I'm probably doing it wrong)

It would almost certainly help here. parse_genome is called 100 times, and parse_genome also calls parse_seq. Each time those functions are called, it compiles several regexes.

@Paradoxdruid See: GitHub - rust-lang/regex: An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.

You can use once_cell or lazy_static for this.

3 Likes