vyperlang / vyper

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

feat[venom]: add `extract_literals` pass #4067

Closed charles-cooper closed 1 month ago

charles-cooper commented 1 month ago

What I did

extract IRLiterals which are instruction arguments; this reduces pressure on the stack scheduler

not sure that this is a good idea, but empirically it seems to work. for example, CurveStableSwapNG-0.4.0.vy goes from from 21849 to 21645 (204 bytes, i.e. 1%)

How I did it

How to verify it

Commit message

extract `IRLiterals` which are instruction arguments; this reduces
pressure on the stack scheduler because `_emit_input_operands` can cause
stack storms when we hit `_stack_reorder`. by extracting them, we allow
`DFTPass` to reorder literal emission in a more optimized way before
even getting to `_emit_input_operands`

Description for the changelog

Cute Animal Picture

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

charles-cooper commented 1 month ago

but not across the board. snekmate/utils/mocks/math_mock.vy has a performance regression for instance.