Skip to content

Use unordered_flat_set to speed up pathological compile time - #17007

Open
msooseth wants to merge 2 commits into
developfrom
use_boost_unordered_set_for_object
Open

msooseth wants to merge 2 commits into
developfrom
use_boost_unordered_set_for_object

Conversation

@msooseth

Copy link
Copy Markdown
Contributor

Description

This speeds up Object::Structure Object::summarizeStructure() const in pathological cases such as #16745 by quite a bit: 39s down to 28.3s to run.

Also removing unused function, topLevelSubObjectNames()

The only tricky part is that unordered_flat_set potentially invalidates iterators when insert/emplace-ing. This is not the case with std::set.

Performance before these changes on #16745 :

        Command being timed: "./solc/solc --bin --experimental --via-ssa-cfg --optimize-yul source.sol"
        User time (seconds): 39.38

Performance after these changes:

        Command being timed: "./solc/solc --bin --experimental --via-ssa-cfg --optimize-yul source.sol"
        User time (seconds): 28.28

Note that I can't just use util::unordered_flat_set<std::string>, the hash function really makes a difference, since the strings are long. I am also constructing the string first and then checking, this way we don't generate them twice.

Note that I can't use std::string const because then the std::move is not effective. This way it's faster (by about 1.5s).

Checklist

AI Disclosure

  • No AI tools were used
  • I asked an AI to review

@msooseth
msooseth requested a review from clonker September 14, 2026 12:16
This speeds up `Object::Structure Object::summarizeStructure() const` in
pathological cases such as #16745 by quite a bit: 37s down to 31s to
run.

Also removing unused function, `topLevelSubObjectNames()`
@msooseth
msooseth force-pushed the use_boost_unordered_set_for_object branch from a209f77 to b3235c1 Compare September 14, 2026 12:30
@msooseth msooseth changed the title Use boost unordered set for object Use unordered_flat_set to speed up pathological compile time Sep 16, 2026
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

Successfully merging this pull request may close these issues.

1 participant