SecretNetwork icon indicating copy to clipboard operation
SecretNetwork copied to clipboard

WIP: Added standardized benchmarking tests for contracts

Open Cashmaney opened this issue 2 years ago • 1 comments

bench_test.go now contains tests that can be used for benchmarking purposes.

The goal is to end up with an output that can be comparable across different versions, and give a good estimate of the relative performance of different builds, set ups, etc (SW vs HW/single vs multithread/etc.)

A report is generated (currently to stdout - todo: make this more configurable, maybe to a file or even a server or something) that looks like

*** Timer for test warmup ***
 Ran benchmark: noop for 10 runs
         Results:
         Average: 22.955432ms
         Min: 22.366595ms
         Max: 23.423886ms

*** Timer for test Empty execution (contract startup time) ***
 Ran benchmark: noop for 10 runs
         Results:
         Average: 22.881912ms
         Min: 22.432534ms
         Max: 23.447466ms

*** Timer for test CPU 5000 rounds of sha2 ***
 Ran benchmark: bench_c_p_u for 10 runs
         Results:
         Average: 180.207113ms
         Min: 171.261943ms
         Max: 205.106104ms

*** Timer for test Storage Write 100 different keys ***
 Ran benchmark: bench_write_storage for 10 runs
         Results:
         Average: 142.522437ms
         Min: 26.889592ms
         Max: 165.96981ms

*** Timer for test Storage Read 100 times same key ***
 Ran benchmark: bench_read_storage for 10 runs
         Results:
         Average: 173.879974ms
         Min: 139.743554ms
         Max: 213.721482ms

--- PASS: TestRunBenchmarks (6.01s)

Cashmaney avatar Sep 14 '22 17:09 Cashmaney

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1b30584
Status: ✅  Deploy successful!
Preview URL: https://6b747461.swagger-preview.pages.dev
Branch Preview URL: https://benchmarking.swagger-preview.pages.dev

View logs