Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue when extracting large expression with vecs #493

Open
saulshanabrook opened this issue Dec 11, 2024 · 1 comment
Open

Comments

@saulshanabrook
Copy link
Member

There is currently a performance issue when extracting a large expression with vecs in it.

This PR (#492) adds an example of such a file to the test suite.

I was able to profile the file with samply and can share the performance results:

samply record ./target/profiling/egglog --dont-print-messages tests/eqsat-basic.egg 

Around 20% of the time is spent in TermDag::to_string. We should add a way to disable printing extracting values to strings, because when using with the Python bindings, this work is thrown away.

The remaining 80% is spent in Extract::find_best with about a third inside of that spent in VecSort::extract_expr, ptr::drop_in_place<GenericExpr>, and TermDag::expr_to_term.

@saulshanabrook
Copy link
Member Author

Wow, when I disable printing messages in #492 and use the rewrite of extraction in #495, the time for this benchmark goes down to 400ms!

$ time env RUST_LOG=error ./target/release/egglog --dont-print-messages tests/extract-vec-bench-no-messages.egg 

________________________________________________________
Executed in  391.50 millis    fish           external
   usr time   41.04 millis  189.00 micros   40.85 millis
   sys time    4.21 millis  711.00 micros    3.50 mills

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant