File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 188188 > */
189189 > import perf; // #include <perf>
190190 >
191- > auto fizz_buzz(int n) {
192- > if (n % 15 == 0) {
193- > return "FizzBuzz";
194- > } else if (n % 3 == 0) {
195- > return "Fizz";
196- > } else if (n % 5 == 0) {
197- > return "Buzz";
198- > } else {
199- > return "Unknown";
200- > }
201- > }
202- >
203191 > int main() {
204192 > perf::runner bench{perf::bench::latency{}};
205193 >
194+ > static constexpr auto fizz_buzz = [](int n) {
195+ > if (n % 15 == 0) {
196+ > return "FizzBuzz";
197+ > } else if (n % 3 == 0) {
198+ > return "Fizz";
199+ > } else if (n % 5 == 0) {
200+ > return "Buzz";
201+ > } else {
202+ > return "Unknown";
203+ > }
204+ > };
205+ >
206206 > bench(fizz_buzz, 15);
207207 > bench(fizz_buzz, 3);
208208 > bench(fizz_buzz, 5);
532532 > <details>
533533 > <summary>Profiling/Analyzing</summary>
534534 >
535+ > https://kris-jusiak.github.io/talks/cppcon-2025
536+ >
535537 > </details>
536538 >
537539 > [`Synopsis`](https://github.com/qlibs/perf/blob/main/perf.cppm#L39)
You can’t perform that action at this time.
0 commit comments