bytecodealliance / sightglass

A benchmark suite and tool to compare different implementations of the same primitives.
Apache License 2.0
70 stars 33 forks source link

Display benchmark progress #209

Closed abrown closed 1 year ago

abrown commented 2 years ago

This change emits a string to stderr that indicates how far Sightglass has come in running its benchmarks:

Iterations completed: 42/100

The idea is to provide more immediate and clear feedback than RUST_LOG that Sightglass is doing work and the user can wait for it to finish. This turns out to be rather tricky to do due to the single-process and multi-process paradigms for running benchmarks; the solution is to communicate here with an internal environment variable "protocol."

The other tricky bit is the addition of ANSI terminal escape codes. This allows Sightglass to overwrite the same line and avoid filling up a screen with repeated Iterations completed: ... messages. This part of the PR could be safely removed without change to the counting functionality but I hope that the implementation is simple enough--and pessimistic enough--that it should not cause trouble down the road. I say "pessimistic" because the heuristic for determining if a terminal can support these "overwriting" terminal codes should just default to printing extra lines if anything looks amiss.

This PR is related to #203 and may close that issue.

abrown commented 2 years ago

cc: @cfallin, @jlb6740, @jameysharp.

fitzgen commented 2 years ago

Opened #211 as an alternative approach