Skip to content
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

Added support for mimalloc to pt::pector #60

Closed
degski opened this issue Jun 28, 2019 · 4 comments
Closed

Added support for mimalloc to pt::pector #60

degski opened this issue Jun 28, 2019 · 4 comments

Comments

@degski
Copy link

degski commented Jun 28, 2019

I've added support for mimalloc to pt::pector. pt::pector is a 'better' std::vector (not always) written by Adrien Guinet, who has dropped of the radar, I hope he's doing well. So I have forked that project and I'm doing some minor maintenance. Its license is LGPL (but header only, so I don't really know what that means). pt::pector intends to be a better std::vector. To that purpose (a.o.) a pt::malloc_allocator was added to pt::pector, in order to benefit from std::realloc. This allowed for marginal improvements over std::vector. Now I've added a pt::mimalloc_allocator, so, same thing, just replaced std::malloc and friends with mi_malloc and its girl-friends. This has had a dramatic change in the resulting benchmark numbers.

What I'm doing in the bench-marking is to emplace_back() on a vector of vector-type containers, randomly selected and of random length within a range. The ranges are then iteratively increased and the length of the vectors increases as well. It sounds more complicated than it is, the code is here.

I'm testing this both with VS2019 and with Clang/LLVM-9.0 (trunk) on Windows 10-1903 x64, Intel Ci3 5005U. For VC with LTCG and for Clang with Thin LTO.

Results for VS2019:

06/28/19 12:00:18
Running Y:\REPOS\podder\x64\Release\benchmark.exe
Run on (4 X 1995 MHz CPU s)
CPU Caches:
  L1 Data 32K (x2)
  L1 Instruction 32K (x2)
  L2 Unified 262K (x2)
  L3 Unified 3145K (x1)
----------------------------------------------------------------------------------------------------------------------------------
Benchmark                                                                                        Time             CPU   Iterations
----------------------------------------------------------------------------------------------------------------------------------
bm_emplace_back_random<std::vector<std::uint8_t>>/23/8192/repeats:4_mean                       747 ns          802 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/23/8192/repeats:4_median                     746 ns          809 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/23/8192/repeats:4_stddev                    10.9 ns         26.7 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/32/8192/repeats:4_mean                       871 ns          848 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/32/8192/repeats:4_median                     873 ns          889 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/32/8192/repeats:4_stddev                    3.91 ns         91.2 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/64/8192/repeats:4_mean                       874 ns          907 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/64/8192/repeats:4_median                     871 ns          893 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/64/8192/repeats:4_stddev                    8.87 ns         70.2 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/128/8192/repeats:4_mean                      873 ns          834 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/128/8192/repeats:4_median                    871 ns          830 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/128/8192/repeats:4_stddev                   9.96 ns         38.4 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/256/8192/repeats:4_mean                      951 ns          977 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/256/8192/repeats:4_median                    948 ns          991 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/256/8192/repeats:4_stddev                   17.9 ns         63.4 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/512/8192/repeats:4_mean                     1275 ns         1231 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/512/8192/repeats:4_median                   1270 ns         1235 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/512/8192/repeats:4_stddev                   19.4 ns         79.2 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/1024/8192/repeats:4_mean                    1866 ns         1836 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/1024/8192/repeats:4_median                  1834 ns         1859 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/1024/8192/repeats:4_stddev                   107 ns         78.5 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/2048/8192/repeats:4_mean                    2652 ns         2576 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/2048/8192/repeats:4_median                  2570 ns         2539 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/2048/8192/repeats:4_stddev                   226 ns          201 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/4096/8192/repeats:4_mean                    4005 ns         3838 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/4096/8192/repeats:4_median                  3980 ns         3838 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/4096/8192/repeats:4_stddev                   302 ns          291 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/8192/8192/repeats:4_mean                    6496 ns         6719 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/8192/8192/repeats:4_median                  6501 ns         6563 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/8192/8192/repeats:4_stddev                   367 ns          442 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_mean              770 ns          750 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_median            766 ns          759 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_stddev           9.64 ns         74.0 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_mean              866 ns          885 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_median            866 ns          907 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_stddev           1.75 ns         74.5 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_mean              859 ns          859 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_median            860 ns          859 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_stddev           2.75 ns         46.0 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_mean             870 ns          931 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_median           870 ns          935 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_stddev          1.54 ns         20.9 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_mean             923 ns          977 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_median           921 ns         1004 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_stddev          7.22 ns         78.9 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_mean            1164 ns         1193 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_median          1166 ns         1224 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_stddev          9.91 ns         70.4 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_mean           1607 ns         1656 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_median         1607 ns         1679 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_stddev         5.47 ns          137 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_mean           2000 ns         1978 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_median         2001 ns         1904 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_stddev         8.88 ns          228 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_mean           2777 ns         2920 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_median         2767 ns         2905 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_stddev         32.1 ns          156 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_mean           4755 ns         4883 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_median         4752 ns         4883 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_stddev         58.6 ns          114 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_mean            408 ns          432 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_median          407 ns          430 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_stddev         3.49 ns         25.7 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_mean            416 ns          430 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_median          417 ns          425 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_stddev         1.58 ns         25.5 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_mean            435 ns          475 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_median          434 ns          477 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_stddev         3.69 ns         46.5 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_mean           463 ns          445 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_median         464 ns          452 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_stddev        2.66 ns         48.1 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_mean           530 ns          509 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_median         525 ns          502 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_stddev        10.9 ns         58.6 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_mean           606 ns          645 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_median         607 ns          637 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_stddev        1.27 ns         65.2 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_mean          798 ns          792 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_median        783 ns          795 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_stddev       34.9 ns         41.7 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_mean         1078 ns         1130 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_median       1077 ns         1109 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_stddev       4.59 ns         80.1 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_mean         1652 ns         1611 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_median       1653 ns         1592 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_stddev       8.64 ns          180 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_mean         2931 ns         2965 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_median       2934 ns         2965 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_stddev       15.1 ns         90.1 ns            4

And with Clang the results are [very different, but still putting mipector (the one backed by mimalloc) in the lead]:

06/28/19 12:04:41
Running podder-benchmark.exe
Run on (4 X 1995 MHz CPU s)
CPU Caches:
  L1 Data 32K (x2)
  L1 Instruction 32K (x2)
  L2 Unified 262K (x2)
  L3 Unified 3145K (x1)
----------------------------------------------------------------------------------------------------------------------------------
Benchmark                                                                                        Time             CPU   Iterations
----------------------------------------------------------------------------------------------------------------------------------
bm_emplace_back_random<std::vector<std::uint8_t>>/23/8192/repeats:4_mean                       710 ns          698 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/23/8192/repeats:4_median                     707 ns          715 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/23/8192/repeats:4_stddev                    6.30 ns         88.9 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/32/8192/repeats:4_mean                       710 ns          725 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/32/8192/repeats:4_median                     710 ns          732 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/32/8192/repeats:4_stddev                    2.46 ns         19.7 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/64/8192/repeats:4_mean                       723 ns          774 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/64/8192/repeats:4_median                     725 ns          781 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/64/8192/repeats:4_stddev                    6.81 ns         47.7 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/128/8192/repeats:4_mean                      745 ns          734 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/128/8192/repeats:4_median                    745 ns          719 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/128/8192/repeats:4_stddev                   7.13 ns         44.2 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/256/8192/repeats:4_mean                      792 ns          802 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/256/8192/repeats:4_median                    794 ns          816 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/256/8192/repeats:4_stddev                   8.04 ns         33.2 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/512/8192/repeats:4_mean                     1052 ns         1011 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/512/8192/repeats:4_median                   1057 ns         1018 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/512/8192/repeats:4_stddev                   12.1 ns         47.7 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/1024/8192/repeats:4_mean                    1532 ns         1583 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/1024/8192/repeats:4_median                  1518 ns         1573 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/1024/8192/repeats:4_stddev                  43.8 ns         85.1 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/2048/8192/repeats:4_mean                    1933 ns         2026 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/2048/8192/repeats:4_median                  1933 ns         2026 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/2048/8192/repeats:4_stddev                  53.8 ns         63.0 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/4096/8192/repeats:4_mean                    2597 ns         2667 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/4096/8192/repeats:4_median                  2625 ns         2651 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/4096/8192/repeats:4_stddev                   108 ns          147 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/8192/8192/repeats:4_mean                    3843 ns         3578 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/8192/8192/repeats:4_median                  3828 ns         3432 ns            4
bm_emplace_back_random<std::vector<std::uint8_t>>/8192/8192/repeats:4_stddev                  51.7 ns          293 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_mean              765 ns          764 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_median            765 ns          746 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_stddev           3.74 ns         40.1 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_mean              790 ns          766 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_median            784 ns          727 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_stddev           19.5 ns         83.7 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_mean              803 ns          813 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_median            801 ns          766 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_stddev           7.03 ns          129 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_mean             877 ns          886 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_median           844 ns          865 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_stddev          73.8 ns         86.4 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_mean             910 ns          949 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_median           912 ns          893 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_stddev          5.99 ns          133 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_mean            1164 ns         1248 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_median          1165 ns         1224 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_stddev          10.7 ns          176 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_mean           1701 ns         1822 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_median         1701 ns         1822 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_stddev         8.86 ns          179 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_mean           2207 ns         2225 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_median         2210 ns         2225 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_stddev         21.1 ns          169 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_mean           3127 ns         3058 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_median         3128 ns         3040 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_stddev         7.67 ns         70.1 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_mean           5252 ns         4778 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_median         5256 ns         4743 ns            4
bm_emplace_back_random<pector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_stddev          138 ns          562 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_mean            412 ns          377 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_median          412 ns          374 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/23/8192/repeats:4_stddev         1.15 ns         53.8 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_mean            421 ns          415 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_median          421 ns          413 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/32/8192/repeats:4_stddev         1.44 ns         26.5 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_mean            443 ns          439 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_median          442 ns          454 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/64/8192/repeats:4_stddev         2.38 ns         42.0 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_mean           484 ns          502 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_median         484 ns          495 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/128/8192/repeats:4_stddev       0.331 ns         52.2 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_mean           552 ns          559 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_median         552 ns          578 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/256/8192/repeats:4_stddev        1.31 ns         39.1 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_mean           657 ns          698 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_median         657 ns          705 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/512/8192/repeats:4_stddev        2.61 ns         41.1 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_mean          866 ns          848 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_median        868 ns          858 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/1024/8192/repeats:4_stddev       5.89 ns         71.5 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_mean         1249 ns         1311 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_median       1250 ns         1283 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/2048/8192/repeats:4_stddev       4.56 ns         96.7 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_mean         1995 ns         2053 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_median       1998 ns         2066 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/4096/8192/repeats:4_stddev       13.5 ns         50.1 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_mean         3626 ns         3721 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_median       3618 ns         3721 ns            4
bm_emplace_back_random<mipector<std::uint8_t, std::int64_t>>/8192/8192/repeats:4_stddev       46.5 ns          133 ns            4

Just sharing, time for a better vector has never looked better than now! Thanks for this great allocator.

@daanx
Copy link
Collaborator

daanx commented Jun 28, 2019

The results are a bit hard to read, if I reformat, I get:

                (std)malloc       mimalloc
test          vector   pector     pector
----------------------------------------------
/64/8192       844ns    860ns      434ns
/2048/8192/   3277ns   2767ns     1077ns

Wow! that are big improvements :-) Thank you for sharing this -- I will try to include this in the mimalloc-bench project as a benchmark.

Thanks again, -- always interested in benchmark results

@degski
Copy link
Author

degski commented Jun 29, 2019

@daanx I'm a bit pissed off, though! ;-)

Because, this podder project (of which the benchmark is part) has become virtually obsolete in one fell swoop. I'll have to file it under 'learning experience' now.

Another interesting observation is to see how bad vc-19.21 is at optimizing its own STL, and how much better clang-cl-9.0 is at it [it's all the same STL, literally the same code being compiled (apart from built_ins in clang/llvm of course)]. Furthermore, the absolute best combination is VS2019 + pt::pector + mimalloc, while the worst is VS2019 + std::vector.

PS: I've updated the pt::pector readme to include pt::mimalloc_allocator with a reference to and a few lines related to mimalloc (and where to find it).

@degski
Copy link
Author

degski commented Jun 30, 2019

@daanx I've looked a the vc results (with std::vector) and it appears optimization could better with /GL (link time code generation) and I have updated the relevant figures. The conclusions still stand, it just corrects (for the better, the result of vc).

                (std)  malloc     mimalloc
test          vector   pector     pector
----------------------------------------------
/64/8192       871ns    860ns      434ns
/2048/8192    2570ns   2001ns     1077ns

The figure in your overview for malloc-backed pt::pector 2048, reported the figure for 4096.

@daanx
Copy link
Collaborator

daanx commented Jul 2, 2019

Thanks so much for including a reference to mimalloc! And thanks for spotting the mistake and giving the updated times -- still amazing to see such difference. I am planning to include pector in the mimalloc-bench repository :-)

@daanx daanx closed this as completed Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants