nimbus-eth1/nimbus/transaction
Jacek Sieka b3cb51e89e
Speed up evm stack (#2881)
The EVM stack is a hot spot in EVM execution and we end up paying a nim
seq tax in several ways, adding up to ~5% of execution time:

* on initial allocation, all bytes get zeroed - this means we have to
choose between allocating a full stack or just a partial one and then
growing it
* pushing and popping introduce additional zeroing
* reallocations on growth copy + zero - expensive again!
* redundant range checking on every operation reducing inlining etc

Here a custom stack using C memory is instroduced:

* no zeroing on allocation
* full stack allocated on EVM startup -> no reallocation during
execution
* fast push/pop - no zeroing again
* 32-byte alignment - this makes it easier for the compiler to use
vector instructions
* no stack allocated for precompiles (these never use it anyway)

Of course, this change also means we have to manage memory manually -
for the EVM, this turns out to be not too bad because we already manage
database transactions the same way (they have to be freed "manually") so
we can simply latch on to this mechanism.

While we're at it, this PR also skips database lookup for known
precompiles by resolving such addresses earlier.
2024-11-30 10:07:10 +01:00
..
call_common.nim Speed up evm stack (#2881) 2024-11-30 10:07:10 +01:00
call_evm.nim Speed up evm stack (#2881) 2024-11-30 10:07:10 +01:00
call_types.nim Speed up evm stack (#2881) 2024-11-30 10:07:10 +01:00
evmc_dynamic_loader.nim Cache code and invalid jump destination tables (fixes #2268) (#2404) 2024-06-21 09:44:10 +02:00
evmc_host_glue.nim Speed up evm stack (#2881) 2024-11-30 10:07:10 +01:00
evmc_vm_glue.nim Convert GasInt to uint64, bump nim-eth and nimbus-eth2 (#2461) 2024-07-07 06:52:11 +00:00
host_call_nested.nim Speed up evm stack (#2881) 2024-11-30 10:07:10 +01:00
host_services.nim Fix incomplete PR #2877 (#2880) 2024-11-27 17:45:37 +07:00
host_trace.nim Fixes related to Prague execution requests (#2847) 2024-11-08 10:47:07 +07:00
host_types.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00