Sovereign 8s.is mirror of standardgalactic/e-graph
  • Rust 99.8%
  • Makefile 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Saul Shanabrook 73975c9819
Some checks failed
Build and Test / nits (push) Has been cancelled
Publish Docs / docs (push) Has been cancelled
Build and Test / test (push) Has been cancelled
Make Quanta optional with a standard clock fallback (#368)
* Make Quanta optional with a standard clock fallback

* Shorten clock selection documentation
2026-09-28 14:56:38 -07:00
.github/workflows Fix CI issues by setting up rust 2026-03-10 08:30:09 -07:00
doc Tweak the e-graphs figure 2020-10-26 13:37:20 -07:00
src Make Quanta optional with a standard clock fallback (#368) 2026-09-28 14:56:38 -07:00
tests Make Quanta optional with a standard clock fallback (#368) 2026-09-28 14:56:38 -07:00
.gitignore Add a way to get csv benchmark data 2022-08-29 10:40:32 -07:00
Cargo.toml Make Quanta optional with a standard clock fallback (#368) 2026-09-28 14:56:38 -07:00
CHANGELOG.md Make version 0.11.0 2025-12-03 16:10:27 -08:00
CITATION.bib Update citation info 2026-03-10 08:07:52 -07:00
LICENSE Do some stuff to get ready for packaging 2019-05-09 10:07:44 -07:00
Makefile Make Quanta optional with a standard clock fallback (#368) 2026-09-28 14:56:38 -07:00
README.md Make Quanta optional with a standard clock fallback (#368) 2026-09-28 14:56:38 -07:00
rust-toolchain Fix a bunch of rust nits 2026-03-10 08:43:47 -07:00

egg logo egg: egraphs good

Crates.io Released Docs.rs Main branch docs Zulip

egg is a library for e-graphs and equality saturation. It can be used to build program optimizers, synthesizers, verifiers, and more. For more information, see these resources:

Also check out the egglog system that provides an alternative approach to equality saturation based on Datalog. It features a language-based design, incremental execution, and composable analyses. See also the paper and the egglog web demo.

Are you using egg? Please cite using this BibTeX citation and add your project to the "Awesome E-graphs" page!

Using egg

Add egg to your Cargo.toml like this:

[dependencies]
egg = "0.11.0"

Make sure to compile with --release if you are measuring performance!

Clock selection

By default, egg uses Quanta for timing. Quanta can make clock reads cheaper, but may take up to 200 ms to initialize. For faster startup with std::time::Instant, set these options on your existing egg dependency:

[dependencies.egg]
# Keep your existing dependency source here.
default-features = false
features = ["std"]

Developing

It's written in Rust. Typically, you install Rust using rustup.

Run cargo doc --open to build and open the documentation in a browser.

Before committing/pushing, make sure to run make, which runs all the tests and lints that CI will (including those under feature flags). This requires the cbc solver due to the lp feature.

Tests

Running cargo test will run the tests. Some tests may time out; try cargo test --release if that happens.

There are a couple interesting tests in the tests directory:

  • prop.rs implements propositional logic and proves some simple theorems.
  • math.rs implements real arithmetic, with a little bit of symbolic differentiation.
  • lambda.rs implements a small lambda calculus, using egg as a partial evaluator.

Benchmarking

To get a simple csv of the runtime of each test, you set the environment variable EGG_BENCH_CSV to something to append a row per test to a csv.

Example:

EGG_BENCH_CSV=math.csv cargo test --test math --release -- --nocapture --test --test-threads=1