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

Optimize CFG construction #614

Merged
merged 9 commits into from
Mar 18, 2022
Merged

Optimize CFG construction #614

merged 9 commits into from
Mar 18, 2022

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Feb 28, 2022

In light of #603, I spent a bunch of time myself trying to understand what's going on and finding ways to optimize the situation. These changes have been cherry-picked from #609 as they should be in working condition and mergeable.

Changes

  1. Add timing to CFG construction with minimal indent changes.
  2. Output CFG hashtable statistics.
  3. Replace add and find_all with replace and the values being lists. This gives equivalent multimap behavior but makes it more explicit and notably keeps the hashtable bucket sizes much smaller. For example, on a subset of 50 OpenSSL files, instead of maximum bucket length of 198, it now is 9.
  4. Decrease initial sizes of some hashtables. Otherwise there are large amounts of hashtables that have very low load factor, so they allocate unnecessarily long arrays for a handful of elements. This is also detrimental to memory usage and caching.

TODO

  • Decrease initial sizes of more hashtables.
  • Change multimap presentation in SCCs as well.

@sim642 sim642 added the performance Analysis time, memory usage label Feb 28, 2022
@sim642 sim642 merged commit bc1c3a5 into master Mar 18, 2022
@sim642 sim642 deleted the cfg-optimize-pick branch March 18, 2022 07:35
@sim642 sim642 added this to the v2.0.0 milestone Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Analysis time, memory usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants