vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.83k stars 789 forks source link

feat[venom]: optimize `get_basic_block()` #4002

Closed charles-cooper closed 3 months ago

charles-cooper commented 3 months ago

What I did

How I did it

How to verify it

Commit message

`get_basic_block()` is a hotspot in venom (up to 35% of total
compilation time!). this optimizes `get_basic_block()`, on a large
contract near the 24kb limit this reduces time spent in venom from 3s to
1s (total time from 6s to 4s).

note on the same contract, time spent in the IRnode optimizer pipeline
is 2s - so time in venom is now smaller than time in legacy optimizer(!)

notes:
- refactor to use dict for basic_blocks
- clean up basic blocks API 
    hide basic blocks behind `get_basic_blocks()` iterator and
    `num_basic_blocks`.

Description for the changelog

Cute Animal Picture

![Put a link to a cute animal picture inside the parenthesis-->]()

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 71.87500% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 88.01%. Comparing base (3af5390) to head (093c4f3).

:exclamation: Current head 093c4f3 differs from pull request most recent head 81d7311. Consider uploading reports for the commit 81d7311 to get more accurate results

Files Patch % Lines
vyper/venom/function.py 76.47% 7 Missing and 1 partial :warning:
vyper/venom/passes/simplify_cfg.py 46.15% 5 Missing and 2 partials :warning:
vyper/venom/analysis/dominators.py 0.00% 1 Missing :warning:
vyper/venom/ir_node_to_venom.py 66.66% 1 Missing :warning:
vyper/venom/passes/normalization.py 50.00% 0 Missing and 1 partial :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #4002 +/- ## ========================================== - Coverage 90.86% 88.01% -2.86% ========================================== Files 103 103 Lines 14908 14905 -3 Branches 3304 3303 -1 ========================================== - Hits 13546 13118 -428 - Misses 941 1291 +350 - Partials 421 496 +75 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.