feat: Restore hashing args via slice for performance - #5539
Conversation
commented
Apr 3, 2024
Benchmark resultsMetrics with a significant change:
Detailed resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. Values are compared against data from master at commit L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 16 txs.
Circuits statsStats on running time and I/O sizes collected for every circuit run across all benchmarks.
Tree insertion statsThe duration to insert a fixed batch of leaves into each tree type.
MiscellaneousTransaction sizes based on how many contract classes are registered in the tx.
Transaction size based on fee payment method
Transaction processing duration by data writes.
|
I replaced the ArgsHasher struct with a BoundedVec because a noir version completely separated slices and generic arrays in the frontend, so we couldn't pass it to the hash_args fn that needed an array. This makes unconstrained fns slower since they have to allocate in memory the full max length that the arguments could have.
In this PR I instead move to a full slice approach, where hash_args takes a slice and hash_args_array just casts it to a slice. This avoids allocating memory unnecessarily in public functions.