Skip to content

Commit 7737b3a

Browse files
committed
f
1 parent ef95445 commit 7737b3a

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

perf

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,21 +188,21 @@
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);
@@ -532,6 +532,8 @@
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)

0 commit comments

Comments
 (0)