egraphs-good / extraction-gym

benchmarking e-graph extraction
MIT License
24 stars 15 forks source link

Use a map that is faster with integer keys #22

Closed TrevorHansen closed 7 months ago

TrevorHansen commented 7 months ago

While I was working through the comments on my pull requests, I noticed that the greedy_dag uses the std hashmap which is slow with integer keys. This patch speeds it up by about 30%. Here is the comparison:

Loaded 512 jsons.
extractors: ['fx-greedy-dag', 'hashmap-greedy-dag']
cumulative time for fx-greedy-dag: 36099ms
cumulative time for hashmap-greedy-dag: 53058ms
fx-greedy-dag / hashmap-greedy-dag
geo mean
tree: 1.0000
dag: 1.0000
micros: 0.8621
quantiles
tree:   1.0000, 1.0000, 1.0000, 1.0000, 1.0000
dag:    1.0000, 1.0000, 1.0000, 1.0000, 1.0000
micros: 0.3409, 0.7740, 0.8178, 0.8729, 2.3235