quii / learn-go-with-tests

Learn Go with test-driven development
MIT License
21.99k stars 2.79k forks source link

Chapter iteration benchmark #694

Open WaDelma opened 1 year ago

WaDelma commented 1 year ago

Currently the benchmark shown there doesn't assign the return value of Repeat anywhere. This means that it could get optimized away and we'd get useless benchmark results.

There should be at least warning about this or the example should be modified so that such optimization cannot happen. Here is an example how this can apparently be done.

quii commented 2 months ago

Today I learned! It would be good if someone could add a note about this