AleoNet / snarkVM

A Virtual Machine for Zero-Knowledge Executions
https://snarkvm.org
Apache License 2.0
1.08k stars 1.5k forks source link

Delegator benchmarks #2436

Closed iamalwaysuncomfortable closed 7 months ago

iamalwaysuncomfortable commented 7 months ago

Motivation

It is desirable to have an idea of performance of functions that touch committee update logic as well the performance of accessor methods to credits.aleo mappings that are related to staking when the number of delegators is at the maximum allowed value.

This PR adds benchmarks of those functions.

Initial Results

Benching using Criterion of both get_value_speculative and get_value_confirmed mappings using RocksDB on Mac OSX 12.6.3 - M1 10-cores - 64 GB memory

Yields the following benchmarks. Most benchmarks for entries ranging from 10 -> 100_000 show a runtime within the vicinity of 100µs. These benchmarks are congruent with other benchmarks on the GET opcode which showed that GET access times do not significantly vary by number of entries into the RocksDB database.

bonded mapping - get_value_speculative - 10 entries
                        time:   [96.503 µs 98.889 µs 101.86 µs]

bonded mapping - get_value_confirmed - 10 entries
                        time:   [100.72 µs 107.79 µs 115.61 µs]

bonded mapping - get_value_speculative - 5000 entries
                        time:   [99.627 µs 102.78 µs 106.21 µs]

bonded mapping - get_value_confirmed - 5000 entries
                        time:   [100.06 µs 102.98 µs 106.25 µs]

bonded mapping - get_value_speculative - 10000 entries
                        time:   [99.627 µs 102.30 µs 105.59 µs]

bonded mapping - get_value_confirmed - 10000 entries
                        time:   [95.546 µs 96.749 µs 98.016 µs]

bonded mapping - get_value_speculative - 20000 entries
                        time:   [96.398 µs 97.753 µs 99.278 µs]

bonded mapping - get_value_confirmed - 20000 entries
                        time:   [104.20 µs 108.21 µs 112.85 µs]

bonded mapping - get_value_speculative - 40000 entries
                        time:   [104.28 µs 109.62 µs 115.32 µs]

bonded mapping - get_value_confirmed - 40000 entries
                        time:   [105.31 µs 110.04 µs 115.15 µs]

bonded mapping - get_value_speculative - 80000 entries
                        time:   [101.54 µs 105.31 µs 109.49 µs]

bonded mapping - get_value_confirmed - 80000 entries
                        time:   [100.00 µs 102.41 µs 105.09 µs]

bonded mapping - get_value_speculative - 100000 entries
                        time:   [102.33 µs 105.51 µs 109.01 µs]

bonded mapping - get_value_confirmed - 100000 entries
                        time:   [98.283 µs 100.21 µs 102.35 µs]