Metatheory.jl
Metatheory.jl copied to clipboard
Optimize internal operations in E-Graphs
The EGraph
type and operations extensively use dictionaries. Consider performance tips from the Julia manual:
https://docs.julialang.org/en/v1/manual/performance-tips/
- Replace unefficient/memory hungry data structures (dictionaries, sets, dynamic arrays) with more efficient and specific (e.g. static arrays, sparse matrices) ones.
- Consider using StaticArrays
- Avoid containers with abstract type parameters
- Annotate values taken from untyped locations
- Write Type Stable Functions
- Avoid Changing Variable Types
- Use Loop Vectorization where possible: when the execution order does not matter.
- Use parallel for loops with @threads or FLoops.jl
From https://dl.acm.org/doi/pdf/10.1145/3434304 : "egg sorts e-nodes within each e-class ot enable binary search and also maintains a cache mapping function symbols to e-classes that contain e-nodes with that function symbol"