etcd-io / bbolt

An embedded key/value database for Go.
https://go.etcd.io/bbolt
MIT License
8.32k stars 645 forks source link

cmd/bbolt: write bench results to stdout #767

Closed ivanvc closed 5 months ago

ivanvc commented 5 months ago

Follow-up on #765, and work towards #750 and #739.

This PR changes the output of the bench results to stdout rather than stderr for ease of working with the output.

However, I'm unsure if we would consider this a breaking change. If we want to delay this change, I can work around this.

ivanvc commented 5 months ago

/cc @tjungblu @ahrtr

tjungblu commented 5 months ago

I think the reason it has split pipes is to not have the progress output mingled together with the result output. Maybe we should swap those?

As for it being a breaking change, I think that's a rather minor breakage... I'm not even sure if anyone else besides us is using the command.

ahrtr commented 5 months ago

I think the reason it has split pipes is to not have the progress output mingled together with the result output. Maybe we should swap those?

My understanding is that we only print errors and usage to Stderr, all others (including progress and results) should go to Stdout?

ivanvc commented 5 months ago

I think the reason it has split pipes is to not have the progress output mingled together with the result output. Maybe we should swap those?

@tjungblu, I'm sorry, I may not have understood you. Are you suggesting sending progress and errors to stdout and the result to stderr?

My understanding is that we only print errors and usage to Stderr, all others (including progress and results) should go to Stdout?

@ahrtr, I don't know if my point of view is biased or opinionated, but it makes sense to me that only the application's actual output goes to stdout.

For example, if I want to pipe or use the results from a bench run, if there's progress report on stdout, I'll need to filter it before I can work with it. i.e.,:

./bbolt bench -gobench-output -write-mode rnd -read-mode seq 2>/dev/null | grep ^Benchmark | tee result.txt
# vs.
./bbolt bench -gobench-output -write-mode rnd -read-mode seq 2>/dev/null | tee result.txt

benchstat result.txt result-old.txt ...
ahrtr commented 5 months ago

only the application's actual output goes to stdout.

For example, if I want to pipe or use the results from a bench run, if there's progress report on stdout, I'll need to filter it before I can work with it. i.e.,:

./bbolt bench -gobench-output -write-mode rnd -read-mode seq 2>/dev/null | grep ^Benchmark | tee result.txt
# vs.
./bbolt bench -gobench-output -write-mode rnd -read-mode seq 2>/dev/null | tee result.txt

benchstat result.txt result-old.txt ...

Sounds good to me.

tjungblu commented 5 months ago

/lgtm