[libcxx-commits] [PATCH] D61878: Change how containers are compared

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 16 11:58:05 PDT 2019


zoecarver updated this revision to Diff 199877.
zoecarver added a comment.

I made a mistake and did not update the comparison function correctly, so most of the optimizations were not applied. No wonder it was giving such a weird benchmark score. Now that I have updated the comparison function, it is faster //every time// (with the exception of the last string test which goes back and forth):

  Load Average: 6.94, 4.27, 3.07
  -------------------------------------------------------------------------------------
  Benchmark                                          Time             CPU   Iterations
  -------------------------------------------------------------------------------------
  initialize_data                                0.000 ns        0.000 ns            0
  test_old/OLD_compare_small_set                 64835 ns        64759 ns         9022
  test_new/NEW_compare_small_set                 25215 ns        25209 ns        27516
  test_old/OLD_compare_similar_set               85983 ns        85929 ns         7419
  test_new/NEW_compare_similar_set               23424 ns        23408 ns        31177
  test_old/OLD_compare_big_set                88360371 ns     88124500 ns            6
  test_new/NEW_compare_big_set                67877017 ns     67856889 ns            9
  test_old/OLD_compare_big_set_different      76333837 ns     76093818 ns           11
  test_new/NEW_compare_big_set_different      75138186 ns     74695111 ns            9
  test_old/OLD_compare_oposite_order_set     324600832 ns    324167000 ns            2
  test_new/NEW_compare_oposite_order_set     276399596 ns    275194333 ns            3
  test_old/OLD_compare_random_set             12322272 ns     12318583 ns           72
  test_new/NEW_compare_random_set              3413009 ns      3411407 ns          216
  test_old/OLD_compare_random_set_different       3004 ns         3002 ns       233761
  test_new/NEW_compare_random_set_different       2958 ns         2951 ns       225822
  test_old/OLD_compare_short_string             237232 ns       237151 ns         3006
  test_new/NEW_compare_short_string              62076 ns        61986 ns        11166
  test_old/OLD_compare_long_string             1310500 ns      1310243 ns          519
  test_new/NEW_compare_long_string              108740 ns       108724 ns         6146
  test_old/OLD_compare_different_strings           345 ns          345 ns      1963061
  test_new/NEW_compare_different_strings           364 ns          362 ns      1948509

Sorry about that mistake, now it should work properly.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61878/new/

https://reviews.llvm.org/D61878

Files:
  benchmarks/unordered_set_comp.bench.cpp
  include/unordered_map
  include/unordered_set

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61878.199877.patch
Type: text/x-patch
Size: 19476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190516/e133c6ef/attachment-0001.bin>


More information about the libcxx-commits mailing list