slog: use *Logger instead of Logger
Using *Logger instead of Logger would seem to require allocation in
logger.WithContext(ctx).LogAttrs(...)
but it does not.
Most other benchmarks are substantially unchanged.
Change-Id: I74b04205d500507fd40dca6d48be676a32d94d0a
Reviewed-on: https://go-review.googlesource.com/c/exp/+/448716
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/slog/benchmarks/slog-pc.bench b/slog/benchmarks/slog-pc.bench
index 2787585..078e75f 100644
--- a/slog/benchmarks/slog-pc.bench
+++ b/slog/benchmarks/slog-pc.bench
@@ -2,105 +2,105 @@
goarch: amd64
pkg: golang.org/x/exp/slog/benchmarks
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
-BenchmarkAttrs/disabled/5_args-8 100000000 11.01 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args-8 100000000 10.98 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args-8 100000000 11.06 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args-8 100000000 10.94 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args-8 100000000 10.96 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 99092853 11.01 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 100000000 11.25 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 100000000 11.02 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 100000000 11.12 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 92644926 11.11 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 56434416 19.35 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 61031977 19.12 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 61348626 20.74 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 61096641 19.15 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 60736203 19.10 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18585967 64.48 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18430046 64.39 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18544654 64.53 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18481387 64.64 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18459106 64.40 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 3042543 395.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 2997498 403.4 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 3029053 395.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 2922511 395.0 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 3040330 394.7 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 3034948 409.1 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 3025192 396.0 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 3051126 395.9 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 3020608 396.3 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 3033238 395.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 1702170 704.5 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 1683478 701.1 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 1668967 705.1 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 1664659 711.6 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 1710505 712.6 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 536484 2360 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 515458 2392 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 536326 2361 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 524487 2394 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 526851 2385 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 2493134 476.9 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 2480722 483.7 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 2464448 485.8 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 2462064 488.8 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 2435934 479.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 2467768 486.2 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 2481487 487.1 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 2473843 499.9 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 2462508 487.9 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 2468150 482.7 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 1286020 926.2 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 1288137 952.8 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 1281404 934.2 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 1271204 944.3 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 1295236 929.1 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 360975 3248 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 349827 3260 ns/op 1413 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 373995 3306 ns/op 1413 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 345276 3219 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 374112 3284 ns/op 1413 B/op 1 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1000000 1067 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1000000 1066 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1000000 1080 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 988404 1087 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1000000 1041 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1000000 1113 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1000000 1089 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1000000 1142 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1000000 1115 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 971776 1096 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 743016 1713 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 688854 1740 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 708565 1762 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 748605 1706 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 709474 1759 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 236040 5644 ns/op 1477 B/op 17 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 222492 5453 ns/op 1477 B/op 17 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 220213 5867 ns/op 1477 B/op 17 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 207702 5686 ns/op 1477 B/op 17 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 220738 5645 ns/op 1477 B/op 17 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1363849 898.6 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1335759 865.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1270100 925.2 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1355726 862.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1241948 925.0 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1311213 849.4 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1379370 956.9 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1276497 888.0 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1353361 923.2 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1378537 887.3 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 822774 1655 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 678620 1558 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 831974 1508 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 786314 1480 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 899043 1508 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 248425 5033 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 242430 5039 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 234417 5039 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 242533 5150 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 237020 5171 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.05 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.06 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.02 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.02 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args-8 119552956 10.04 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 68263030 17.15 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 66125575 17.29 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 65876311 17.53 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 59792817 17.72 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 66082474 17.44 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 63801992 18.12 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 64687180 18.62 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 63838999 18.25 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 61152484 18.20 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 63157089 18.12 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18687324 63.39 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18578457 63.71 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18771891 63.48 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18879216 64.84 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 15680052 74.84 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 2555260 416.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 2987409 401.1 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 2992893 400.3 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 2982684 401.5 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 2664178 403.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 2934764 409.5 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 2918563 412.0 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 2907992 414.4 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 2917866 412.3 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 2866125 416.5 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 1785664 722.7 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 1708686 678.0 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 1737969 684.0 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 1761217 694.8 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 1736191 678.7 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 477662 2393 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 495931 2415 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 537381 2516 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 494548 2444 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 534930 2352 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 2438030 497.6 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 2383900 494.3 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 2432466 487.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 2462598 486.1 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 2440650 494.3 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 2427572 495.4 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 2421992 495.8 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 2408522 500.9 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 2437830 506.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 2258314 491.0 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 1310647 944.1 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 1325214 907.1 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 1309946 913.8 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 1216821 988.1 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 1318623 972.5 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 305096 3805 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 325173 3224 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 358047 3181 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 360211 3240 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 366141 3289 ns/op 1413 B/op 1 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 1000000 1127 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 960163 1059 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 967842 1099 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 1000000 1064 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 1000000 1049 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1000000 1077 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1000000 1060 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 980160 1053 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1000000 1041 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1117348 1093 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 791455 1719 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 781164 1885 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 661323 1904 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 656154 1956 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 646381 1957 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 199566 6234 ns/op 1477 B/op 17 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 190665 6082 ns/op 1477 B/op 17 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 195008 6248 ns/op 1477 B/op 17 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 204160 6300 ns/op 1477 B/op 17 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 199836 6213 ns/op 1477 B/op 17 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1238695 953.3 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1222155 972.0 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1205894 969.4 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1226110 985.6 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1221817 968.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1000000 1018 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1153074 935.5 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1395823 885.8 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1275787 916.2 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1331715 914.6 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 856378 1494 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 809318 1496 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 856154 1497 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 790920 1506 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 895033 1488 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 230246 5037 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 245506 5023 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 235054 5118 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 222040 5010 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 237818 5117 ns/op 1412 B/op 1 allocs/op
PASS
-ok golang.org/x/exp/slog/benchmarks 147.035s
+ok golang.org/x/exp/slog/benchmarks 148.040s
diff --git a/slog/benchmarks/slog.bench b/slog/benchmarks/slog.bench
index 33ce0cb..e168ba5 100644
--- a/slog/benchmarks/slog.bench
+++ b/slog/benchmarks/slog.bench
@@ -2,105 +2,105 @@
goarch: amd64
pkg: golang.org/x/exp/slog/benchmarks
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
-BenchmarkAttrs/disabled/5_args-8 98288526 11.02 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args-8 100000000 10.97 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args-8 100000000 11.38 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args-8 100000000 11.00 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args-8 100000000 10.99 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 100000000 10.98 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 100000000 11.01 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 94221319 11.01 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 100000000 11.04 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/5_args_ctx-8 100000000 11.00 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 57471814 19.32 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 61708424 19.16 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 57874836 19.17 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 61938594 19.65 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/10_args-8 59963071 19.16 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18328663 64.90 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18434060 65.34 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18177505 65.14 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18379885 65.51 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/disabled/40_args-8 18349190 65.16 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 14130172 85.01 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 14645642 85.50 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 13869007 84.77 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 13934444 84.92 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args-8 14232910 84.39 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 14116840 85.75 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 13792731 84.49 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 14136980 86.16 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 12695575 85.25 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/5_args_ctx-8 14096670 85.01 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 4446147 293.0 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 4037497 288.3 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 4345414 301.7 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 4287226 287.5 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/10_args-8 4355980 275.2 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 1302829 938.0 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 1310755 956.6 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 1292900 964.9 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 1257229 966.8 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/async_discard/40_args-8 1000000 1053 ns/op 1408 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 6900655 166.0 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 6325740 162.1 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 4901541 232.9 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 7193606 170.2 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args-8 7622880 157.6 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 5037357 272.8 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 6330247 166.2 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 7170688 181.0 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 7848153 168.8 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/5_args_ctx-8 6864308 162.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 2274127 513.1 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 2399744 509.5 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 2336054 519.0 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 2369473 519.8 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/10_args-8 2346710 512.1 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 643897 1977 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 537020 2000 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 647682 2021 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 538916 2101 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/fastText_discard/40_args-8 585639 2006 ns/op 1412 B/op 1 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1630633 735.1 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1586420 758.0 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1547044 760.7 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1576621 737.8 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args-8 1556031 788.1 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1555112 778.1 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1531965 811.8 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1514307 791.6 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1596018 758.4 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/5_args_ctx-8 1615444 770.7 ns/op 8 B/op 2 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 972390 1375 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 912907 1343 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 978176 1349 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 914865 1307 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/10_args-8 1000000 1511 ns/op 224 B/op 5 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 240639 4929 ns/op 1477 B/op 17 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 279088 4647 ns/op 1476 B/op 17 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 266191 4596 ns/op 1477 B/op 17 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 256312 4727 ns/op 1477 B/op 17 allocs/op
-BenchmarkAttrs/Text_discard/40_args-8 281548 4638 ns/op 1476 B/op 17 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1768279 664.7 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1882438 669.6 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1936932 589.6 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1823818 612.8 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args-8 1839082 610.1 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1996665 606.6 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1916376 616.2 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 2042916 592.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1744138 635.5 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/5_args_ctx-8 1841967 635.2 ns/op 0 B/op 0 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 1000000 1126 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 1000000 1196 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 1000000 1129 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 1000000 1165 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/10_args-8 1000000 1156 ns/op 208 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 318490 4084 ns/op 1411 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 306403 4194 ns/op 1411 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 303225 4142 ns/op 1411 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 343528 4046 ns/op 1411 B/op 1 allocs/op
-BenchmarkAttrs/JSON_discard/40_args-8 311587 4043 ns/op 1411 B/op 1 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.01 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.02 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.01 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.06 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args-8 100000000 10.13 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 65082175 17.35 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 67560685 17.60 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 66480818 17.88 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 62164170 17.57 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/5_args_ctx-8 64041057 17.29 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 61310364 18.20 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 63852882 18.28 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 64814130 18.18 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 62238019 18.21 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/10_args-8 63806989 18.15 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18776562 63.85 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18797630 63.82 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18422196 63.93 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18422751 63.69 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/disabled/40_args-8 18699580 63.86 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 14650714 82.65 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 14257166 82.45 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 14072110 83.14 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 14197720 83.68 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args-8 14053675 81.93 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 14433480 82.02 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 14615121 83.06 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 14488219 82.62 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 14402234 83.07 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/5_args_ctx-8 14087228 82.22 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 4281078 275.1 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 4331724 272.1 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 4330180 278.8 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 4390335 277.5 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/10_args-8 4445980 273.5 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 1291330 946.1 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 1302540 918.7 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 1255257 936.8 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 1317576 940.5 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/async_discard/40_args-8 1287027 936.7 ns/op 1408 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 6653914 187.8 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 6042549 196.1 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 6296040 186.4 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 4599591 280.9 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args-8 7331044 156.6 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 6785898 189.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 4894164 235.7 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 6214660 221.0 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 7717798 160.1 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/5_args_ctx-8 5849185 189.0 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 2332070 524.3 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 2269552 516.7 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 2384461 518.7 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 2349918 520.6 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/10_args-8 2267647 518.6 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 629695 2012 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 590324 2017 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 529468 1988 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 590164 2044 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/fastText_discard/40_args-8 694128 2013 ns/op 1412 B/op 1 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 1480792 729.7 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 1511230 754.2 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 1536628 753.5 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 1574944 743.5 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args-8 1573424 759.5 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1560421 747.1 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1571598 772.1 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1530306 751.5 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1533139 744.9 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/5_args_ctx-8 1560169 759.3 ns/op 8 B/op 2 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 1000000 1340 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 937830 1380 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 952281 1449 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 1000000 1295 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/10_args-8 945732 1310 ns/op 224 B/op 5 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 275960 4830 ns/op 1476 B/op 17 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 254529 4716 ns/op 1476 B/op 17 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 269155 4695 ns/op 1476 B/op 17 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 273496 4687 ns/op 1476 B/op 17 allocs/op
+BenchmarkAttrs/Text_discard/40_args-8 266942 4752 ns/op 1476 B/op 17 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1881610 635.4 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1880308 618.5 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1867201 597.9 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1799612 601.2 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args-8 1863672 642.6 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1759726 652.0 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1825704 661.6 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1804497 656.5 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1925446 646.4 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/5_args_ctx-8 1963968 577.1 ns/op 0 B/op 0 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 1000000 1143 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 1000000 1176 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 1000000 1157 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 1000000 1161 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/10_args-8 1000000 1199 ns/op 208 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 276656 4100 ns/op 1411 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 289512 4157 ns/op 1411 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 296378 3985 ns/op 1411 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 307710 4153 ns/op 1411 B/op 1 allocs/op
+BenchmarkAttrs/JSON_discard/40_args-8 299431 4021 ns/op 1411 B/op 1 allocs/op
PASS
-ok golang.org/x/exp/slog/benchmarks 146.959s
+ok golang.org/x/exp/slog/benchmarks 146.279s
diff --git a/slog/context.go b/slog/context.go
index 538e350..504adaf 100644
--- a/slog/context.go
+++ b/slog/context.go
@@ -10,14 +10,14 @@
// NewContext returns a context that contains the given Logger.
// Use FromContext to retrieve the Logger.
-func NewContext(ctx context.Context, l Logger) context.Context {
+func NewContext(ctx context.Context, l *Logger) context.Context {
return context.WithValue(ctx, contextKey{}, l)
}
// FromContext returns the Logger stored in ctx by NewContext, or the default
// Logger if there is none.
-func FromContext(ctx context.Context) Logger {
- if l, ok := ctx.Value(contextKey{}).(Logger); ok {
+func FromContext(ctx context.Context) *Logger {
+ if l, ok := ctx.Value(contextKey{}).(*Logger); ok {
return l
}
return Default()
@@ -25,6 +25,6 @@
// Ctx retrieves a Logger from the given context using FromContext. Then it adds
// the given context to the Logger using WithContext and returns the result.
-func Ctx(ctx context.Context) Logger {
+func Ctx(ctx context.Context) *Logger {
return FromContext(ctx).WithContext(ctx)
}
diff --git a/slog/logger.go b/slog/logger.go
index 8be8c34..7d1bfbd 100644
--- a/slog/logger.go
+++ b/slog/logger.go
@@ -14,18 +14,16 @@
var defaultLogger atomic.Value
func init() {
- defaultLogger.Store(Logger{
- handler: newDefaultHandler(log.Output),
- })
+ defaultLogger.Store(New(newDefaultHandler(log.Output)))
}
// Default returns the default Logger.
-func Default() Logger { return defaultLogger.Load().(Logger) }
+func Default() *Logger { return defaultLogger.Load().(*Logger) }
// SetDefault makes l the default Logger.
// After this call, output from the log package's default Logger
// (as with [log.Print], etc.) will be logged at InfoLevel using l's Handler.
-func SetDefault(l Logger) {
+func SetDefault(l *Logger) {
defaultLogger.Store(l)
// If the default's handler is a defaultHandler, then don't use a handleWriter,
// or we'll deadlock as they both try to acquire the log default mutex.
@@ -72,10 +70,10 @@
}
// Handler returns l's Handler.
-func (l Logger) Handler() Handler { return l.handler }
+func (l *Logger) Handler() Handler { return l.handler }
// Context returns l's context.
-func (l Logger) Context() context.Context { return l.ctx }
+func (l *Logger) Context() context.Context { return l.ctx }
// With returns a new Logger that includes the given arguments, converted to
// Attrs as in [Logger.Log]. The Attrs will be added to each output from the
@@ -83,7 +81,7 @@
//
// The new Logger's handler is the result of calling WithAttrs on the receiver's
// handler.
-func (l Logger) With(args ...any) Logger {
+func (l *Logger) With(args ...any) *Logger {
var (
attr Attr
attrs []Attr
@@ -92,34 +90,33 @@
attr, args = argsToAttr(args)
attrs = append(attrs, attr)
}
- l.handler = l.handler.WithAttrs(attrs)
- return l
+ return New(l.handler.WithAttrs(attrs))
}
// WithGroup returns a new Logger that starts a group. The keys of all
// attributes added to the Logger will be qualified by the given name.
-func (l Logger) WithGroup(name string) Logger {
- l.handler = l.handler.WithGroup(name)
- return l
+func (l *Logger) WithGroup(name string) *Logger {
+ return New(l.handler.WithGroup(name))
}
// WithContext returns a new Logger with the same handler
// as the receiver and the given context.
-func (l Logger) WithContext(ctx context.Context) Logger {
- l.ctx = ctx
- return l
+func (l *Logger) WithContext(ctx context.Context) *Logger {
+ l2 := *l
+ l2.ctx = ctx
+ return &l2
}
// New creates a new Logger with the given Handler.
-func New(h Handler) Logger { return Logger{handler: h} }
+func New(h Handler) *Logger { return &Logger{handler: h} }
// With calls Logger.With on the default logger.
-func With(args ...any) Logger {
+func With(args ...any) *Logger {
return Default().With(args...)
}
// Enabled reports whether l emits log records at the given level.
-func (l Logger) Enabled(level Level) bool {
+func (l *Logger) Enabled(level Level) bool {
return l.Handler().Enabled(level)
}
@@ -133,14 +130,14 @@
// the following argument is treated as the value and the two are combined
// into an Attr.
// - Otherwise, the argument is treated as a value with key "!BADKEY".
-func (l Logger) Log(level Level, msg string, args ...any) {
+func (l *Logger) Log(level Level, msg string, args ...any) {
l.LogDepth(0, level, msg, args...)
}
// LogDepth is like [Logger.Log], but accepts a call depth to adjust the
// file and line number in the log record. 0 refers to the caller
// of LogDepth; 1 refers to the caller's caller; and so on.
-func (l Logger) LogDepth(calldepth int, level Level, msg string, args ...any) {
+func (l *Logger) LogDepth(calldepth int, level Level, msg string, args ...any) {
if !l.Enabled(level) {
return
}
@@ -149,18 +146,18 @@
_ = l.Handler().Handle(r)
}
-func (l Logger) makeRecord(msg string, level Level, depth int) Record {
+func (l *Logger) makeRecord(msg string, level Level, depth int) Record {
return NewRecord(time.Now(), level, msg, depth+5, l.ctx)
}
// LogAttrs is a more efficient version of [Logger.Log] that accepts only Attrs.
-func (l Logger) LogAttrs(level Level, msg string, attrs ...Attr) {
+func (l *Logger) LogAttrs(level Level, msg string, attrs ...Attr) {
l.LogAttrsDepth(0, level, msg, attrs...)
}
// LogAttrsDepth is like [Logger.LogAttrs], but accepts a call depth argument
// which it interprets like [Logger.LogDepth].
-func (l Logger) LogAttrsDepth(calldepth int, level Level, msg string, attrs ...Attr) {
+func (l *Logger) LogAttrsDepth(calldepth int, level Level, msg string, attrs ...Attr) {
if !l.Enabled(level) {
return
}
@@ -170,24 +167,24 @@
}
// Debug logs at DebugLevel.
-func (l Logger) Debug(msg string, args ...any) {
+func (l *Logger) Debug(msg string, args ...any) {
l.LogDepth(0, DebugLevel, msg, args...)
}
// Info logs at InfoLevel.
-func (l Logger) Info(msg string, args ...any) {
+func (l *Logger) Info(msg string, args ...any) {
l.LogDepth(0, InfoLevel, msg, args...)
}
// Warn logs at WarnLevel.
-func (l Logger) Warn(msg string, args ...any) {
+func (l *Logger) Warn(msg string, args ...any) {
l.LogDepth(0, WarnLevel, msg, args...)
}
// Error logs at ErrorLevel.
// If err is non-nil, Error appends Any("err", err)
// to the list of attributes.
-func (l Logger) Error(msg string, err error, args ...any) {
+func (l *Logger) Error(msg string, err error, args ...any) {
if err != nil {
// TODO: avoid the copy.
args = append(args[:len(args):len(args)], Any("err", err))
diff --git a/slog/logger_test.go b/slog/logger_test.go
index 3d0e5eb..4d49ccb 100644
--- a/slog/logger_test.go
+++ b/slog/logger_test.go
@@ -158,7 +158,7 @@
func TestAlloc(t *testing.T) {
dl := New(discardHandler{})
- defer func(d Logger) { SetDefault(d) }(Default())
+ defer func(d *Logger) { SetDefault(d) }(Default())
SetDefault(dl)
t.Run("Info", func(t *testing.T) {
@@ -386,7 +386,7 @@
b.Run("WithContext", func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
- l.WithContext(ctx).LogAttrs(InfoLevel, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
+ l.WithContext(ctx).LogAttrs(InfoLevel, "msg2", Int("a", 1), String("b", "two"), Bool("c", true))
}
})
b.Run("WithContext-parallel", func(b *testing.B) {
@@ -397,5 +397,13 @@
}
})
})
-
+ b.Run("Ctx", func(b *testing.B) {
+ dl := Default()
+ SetDefault(l)
+ defer SetDefault(dl)
+ b.ReportAllocs()
+ for i := 0; i < b.N; i++ {
+ Ctx(ctx).LogAttrs(InfoLevel, "msg", Int("a", 1), String("b", "two"), Bool("c", true))
+ }
+ })
}
diff --git a/slog/noplog.bench b/slog/noplog.bench
index 26d67ef..ed9296f 100644
--- a/slog/noplog.bench
+++ b/slog/noplog.bench
@@ -2,30 +2,35 @@
goarch: amd64
pkg: golang.org/x/exp/slog
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
-BenchmarkNopLog/attrs-8 1000000 1120 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-8 1000000 1087 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-8 1000000 1125 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-8 1000000 1112 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-8 1000000 1116 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 3975526 297.7 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 4036947 308.5 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 4063410 297.1 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 4042863 293.7 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 4067066 295.9 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1000000 1051 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1000000 1050 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1000000 1044 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1000000 1057 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1000000 1064 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 1000000 1103 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 1000000 1103 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 1000000 1112 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 1000000 1081 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 1000000 1112 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 4040090 297.1 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 4025874 297.8 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 4039935 296.0 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 4054540 299.9 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 4045884 295.9 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1090 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1097 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1078 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1095 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1096 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 4007268 308.2 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 4016138 299.7 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 4020529 305.9 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 3977829 303.4 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 3225438 318.5 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1179256 994.2 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1000000 1002 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1216710 993.2 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1000000 1013 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1000000 1016 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 989066 1163 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 994116 1163 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 1000000 1152 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 991675 1165 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 965268 1166 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3955503 303.3 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3861188 307.8 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3967752 303.9 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3955203 302.7 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3948278 301.1 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 940622 1247 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 936381 1257 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 959730 1266 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 943473 1290 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 919414 1259 ns/op 0 B/op 0 allocs/op
PASS
-ok golang.org/x/exp/slog 31.654s
+ok golang.org/x/exp/slog 40.566s