[libcxx-commits] [PATCH] D101752: Speedup to_string for integers using zero-copy.
Roman Koshelev via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 6 22:11:51 PDT 2021
Roman-Koshelev added a comment.
Benchmarks
$ g++ -v
gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1)
$ g++ main.cpp -O3 -lbenchmark -std=c++20
$ ./a.out
2021-05-07T07:54:15+03:00
Running ./a.out
Run on (4 X 3000 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x4)
L1 Instruction 32 KiB (x4)
L2 Unified 256 KiB (x4)
L3 Unified 12288 KiB (x4)
Load Average: 0.43, 0.45, 0.41
---------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------
to_stringNewBench/1 693 ns 692 ns 971467
to_stringNewBench/2 933 ns 932 ns 749060
to_stringNewBench/3 2008 ns 2006 ns 342603
to_stringNewBench/4 2034 ns 2032 ns 340914
to_stringNewBench/5 1992 ns 1990 ns 347027
to_stringNewBench/6 1909 ns 1908 ns 345394
to_stringNewBench/7 1947 ns 1945 ns 346533
to_stringNewBench/8 1993 ns 1991 ns 356201
to_stringNewBench/9 1913 ns 1911 ns 362352
to_stringNewBench/10 1958 ns 1956 ns 358725
to_stringNewBench/11 1965 ns 1963 ns 366209
to_stringNewBench/12 1971 ns 1969 ns 354935
to_stringNewBench/13 1927 ns 1925 ns 349851
to_stringNewBench/14 2013 ns 2011 ns 358991
to_stringNewBench/15 2021 ns 2019 ns 356885
to_stringNewBench/16 2011 ns 2009 ns 350729
to_stringOldBench/1 1038 ns 1037 ns 694926
to_stringOldBench/2 1168 ns 1167 ns 590311
to_stringOldBench/3 1601 ns 1600 ns 438899
to_stringOldBench/4 1560 ns 1559 ns 442588
to_stringOldBench/5 4362 ns 4359 ns 161358
to_stringOldBench/6 4306 ns 4303 ns 162674
to_stringOldBench/7 4375 ns 4372 ns 158870
to_stringOldBench/8 4370 ns 4367 ns 166312
to_stringOldBench/9 4334 ns 4331 ns 160176
to_stringOldBench/10 4402 ns 4399 ns 157898
to_stringOldBench/11 4401 ns 4397 ns 158140
to_stringOldBench/12 4330 ns 4327 ns 160746
to_stringOldBench/13 4388 ns 4385 ns 159924
to_stringOldBench/14 4302 ns 4299 ns 158747
to_stringOldBench/15 4358 ns 4354 ns 158021
to_stringOldBench/16 4322 ns 4319 ns 159411
$ clang++ -v
Ubuntu clang version 12.0.0-1ubuntu1
$ clang++ main.cpp -O3 -lbenchmark -std=c++20
$ ./a.out
2021-05-07T07:55:43+03:00
Running ./a.out
Run on (4 X 3000 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x4)
L1 Instruction 32 KiB (x4)
L2 Unified 256 KiB (x4)
L3 Unified 12288 KiB (x4)
Load Average: 0.55, 0.52, 0.44
---------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------
to_stringNewBench/1 689 ns 688 ns 985090
to_stringNewBench/2 835 ns 834 ns 845049
to_stringNewBench/3 1350 ns 1348 ns 522957
to_stringNewBench/4 1364 ns 1362 ns 518457
to_stringNewBench/5 939 ns 938 ns 735028
to_stringNewBench/6 963 ns 962 ns 710654
to_stringNewBench/7 978 ns 977 ns 700846
to_stringNewBench/8 972 ns 971 ns 686915
to_stringNewBench/9 929 ns 928 ns 715882
to_stringNewBench/10 1002 ns 1001 ns 708947
to_stringNewBench/11 1009 ns 1008 ns 651967
to_stringNewBench/12 1040 ns 1039 ns 640582
to_stringNewBench/13 996 ns 995 ns 682899
to_stringNewBench/14 1026 ns 1025 ns 683722
to_stringNewBench/15 977 ns 976 ns 710880
to_stringNewBench/16 965 ns 964 ns 712499
to_stringOldBench/1 970 ns 969 ns 697907
to_stringOldBench/2 1066 ns 1064 ns 629877
to_stringOldBench/3 1489 ns 1488 ns 466870
to_stringOldBench/4 1482 ns 1480 ns 469958
to_stringOldBench/5 4080 ns 4076 ns 170472
to_stringOldBench/6 4219 ns 4214 ns 167871
to_stringOldBench/7 4049 ns 4045 ns 169507
to_stringOldBench/8 4205 ns 4190 ns 165934
to_stringOldBench/9 4094 ns 4091 ns 167660
to_stringOldBench/10 4041 ns 4038 ns 168373
to_stringOldBench/11 4120 ns 4117 ns 170489
to_stringOldBench/12 4084 ns 4080 ns 170699
to_stringOldBench/13 4020 ns 4017 ns 171939
to_stringOldBench/14 4125 ns 4122 ns 171680
to_stringOldBench/15 4091 ns 4088 ns 169939
to_stringOldBench/16 4085 ns 4082 ns 170872
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101752/new/
https://reviews.llvm.org/D101752
More information about the libcxx-commits
mailing list