Skip to content

Question: Does the regex-syntax crate optimize its HIR? #915

Answered by BurntSushi
ckaran asked this question in Q&A
Discussion options

You must be logged in to vote

Does the regex-syntax crate optimize its Hir?

It does a little bit of optimization today. But very little. Here's one example:

pub fn concat(mut exprs: Vec<Hir>) -> Hir {
match exprs.len() {
0 => Hir::empty(),
1 => exprs.pop().unwrap(),
_ => {

I do have a rather large WIP patchset (that will become regex-syntax 0.8 at some point) that beefs up the optimizations. Example 1:

pub fn concat(hirs: Vec<Hir>) -> Hir {
// We rebuild the concatenation by simplifying it. Would be nice to do
// it in place, but tha…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ckaran
Comment options

@BurntSushi
Comment options

@ckaran
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants