We compute num_bytes by non-deterministically guessing the number of bits and checking that number >> number_of_bits - 1 == 1 (if number != 0). For hex_prefix_rlp, instead of writing the nibbles to the rlp segment one by one, we remove the first nibble (if necessary) directly on the packed nibbles and then write them using mstore_unpacking.
For the ERC20 test, we get the following improvements on cpu and memory:
CPU trace: 168206 -> 153563
Memory trace: 694042 -> 648593
We compute
num_bytes
by non-deterministically guessing the number of bits and checking thatnumber >> number_of_bits - 1 == 1
(if number != 0). Forhex_prefix_rlp
, instead of writing the nibbles to the rlp segment one by one, we remove the first nibble (if necessary) directly on the packed nibbles and then write them usingmstore_unpacking
. For the ERC20 test, we get the following improvements on cpu and memory: CPU trace: 168206 -> 153563 Memory trace: 694042 -> 648593