-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
why does fmt::format_to_n perform so much worse than fmt::format_to #3484
Comments
An easy way to optimize Lines 2794 to 2802 in de0757b
A PR would be welcome. |
Applied the optimization in 436c131 which gave ~2x speedup on the given benchmark (tested on macOS with M1 and clang). Compared to your original timing the improvement is even larger possibly due to some other changes. Before:
After:
|
fmt 10.0.0: 2023-07-27T14:55:22+08:00
Running ./benchmark.fmt10
Run on (16 X 2595.12 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x8)
L1 Instruction 32 KiB (x8)
L2 Unified 4096 KiB (x8)
L3 Unified 16384 KiB (x2)
Load Average: 0.57, 0.69, 0.30
---------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------
BM_format_to 78.9 ns 78.9 ns 8881746
BM_format_to_n 568 ns 568 ns 1232089 fmt master: 2023-07-27T14:55:28+08:00
Running ./benchmark.fmt_master
Run on (16 X 2595.12 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x8)
L1 Instruction 32 KiB (x8)
L2 Unified 4096 KiB (x8)
L3 Unified 16384 KiB (x2)
Load Average: 0.52, 0.67, 0.30
---------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------
BM_format_to 54.9 ns 54.9 ns 12727944
BM_format_to_n 133 ns 133 ns 5257795 👍 |
Thanks for testing. |
fmt Version:
10.0.0
Benchmark:
Result:
The text was updated successfully, but these errors were encountered: