zanmato1984 commented on PR #44053:
URL: https://github.com/apache/arrow/pull/44053#issuecomment-2342492864

   The benchmark number, ran on my Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz, 
shows a maximum `50x` speedup, nearly `O(n^2)` to `O(n)`.
   
   Before:
   
   ```cpp
   
----------------------------------------------------------------------------------------------------------------------
   Benchmark                                                            Time    
         CPU   Iterations UserCounters...
   
----------------------------------------------------------------------------------------------------------------------
   BenchmarkRowSegmenter/Rows:32768/Segments:1/SegmentKeys:0        24934 ns    
    24906 ns        27871 bytes_per_second=9.80236Gi/s 
items_per_second=1.31565G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:4/SegmentKeys:0        24729 ns    
    24687 ns        27358 bytes_per_second=9.88957Gi/s 
items_per_second=1.32736G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:16/SegmentKeys:0       24630 ns    
    24616 ns        28100 bytes_per_second=9.91805Gi/s 
items_per_second=1.33118G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:64/SegmentKeys:0       24633 ns    
    24620 ns        28112 bytes_per_second=9.91645Gi/s 
items_per_second=1.33096G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:256/SegmentKeys:0      24679 ns    
    24656 ns        28651 bytes_per_second=9.90192Gi/s 
items_per_second=1.32901G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:1/SegmentKeys:1       199781 ns    
   199339 ns         3606 bytes_per_second=2.4495Gi/s 
items_per_second=164.383M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:4/SegmentKeys:1       222783 ns    
   220778 ns         2905 bytes_per_second=2.21164Gi/s 
items_per_second=148.421M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:16/SegmentKeys:1      254637 ns    
   254545 ns         2703 bytes_per_second=1.91825Gi/s 
items_per_second=128.732M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:64/SegmentKeys:1      452659 ns    
   452356 ns         1550 bytes_per_second=1.07942Gi/s 
items_per_second=72.4385M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:256/SegmentKeys:1    1241185 ns    
  1240526 ns          572 bytes_per_second=403.055Mi/s 
items_per_second=26.4146M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:1/SegmentKeys:2       351964 ns    
   351202 ns         1983 bytes_per_second=1.39031Gi/s 
items_per_second=93.3024M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:4/SegmentKeys:2      1076041 ns    
  1010477 ns          727 bytes_per_second=494.816Mi/s 
items_per_second=32.4282M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:16/SegmentKeys:2     4587149 ns    
  4584191 ns          152 bytes_per_second=109.071Mi/s 
items_per_second=7.14804M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:64/SegmentKeys:2    25132123 ns    
 25118536 ns           28 bytes_per_second=19.9056Mi/s 
items_per_second=1.30453M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:256/SegmentKeys:2  102196767 ns    
102086286 ns            7 bytes_per_second=4.89782Mi/s 
items_per_second=320.983k/s
   BenchmarkRowSegmenter/Rows:32768/Segments:1/SegmentKeys:3       424279 ns    
   423836 ns         1619 bytes_per_second=1.15205Gi/s 
items_per_second=77.3129M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:4/SegmentKeys:3      1180743 ns    
  1157215 ns          610 bytes_per_second=432.072Mi/s 
items_per_second=28.3163M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:16/SegmentKeys:3     5738171 ns    
  5729356 ns          118 bytes_per_second=87.2698Mi/s 
items_per_second=5.71932M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:64/SegmentKeys:3    30695547 ns    
 30656783 ns           23 bytes_per_second=16.3096Mi/s 
items_per_second=1.06887M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:256/SegmentKeys:3  125980210 ns    
125906333 ns            6 bytes_per_second=3.97121Mi/s 
items_per_second=260.257k/s
   ```
   
   After:
   
   ```cpp
   
----------------------------------------------------------------------------------------------------------------------
   Benchmark                                                            Time    
         CPU   Iterations UserCounters...
   
----------------------------------------------------------------------------------------------------------------------
   BenchmarkRowSegmenter/Rows:32768/Segments:1/SegmentKeys:0        24717 ns    
    24709 ns        28098 bytes_per_second=9.8808Gi/s 
items_per_second=1.32618G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:4/SegmentKeys:0        24283 ns    
    24275 ns        28709 bytes_per_second=10.0574Gi/s 
items_per_second=1.34989G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:16/SegmentKeys:0       24426 ns    
    24413 ns        28328 bytes_per_second=10.0006Gi/s 
items_per_second=1.34226G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:64/SegmentKeys:0       24331 ns    
    24320 ns        28073 bytes_per_second=10.0385Gi/s 
items_per_second=1.34735G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:256/SegmentKeys:0      26190 ns    
    25537 ns        28471 bytes_per_second=9.56034Gi/s 
items_per_second=1.28317G/s
   BenchmarkRowSegmenter/Rows:32768/Segments:1/SegmentKeys:1       197105 ns    
   196813 ns         3587 bytes_per_second=2.48093Gi/s 
items_per_second=166.493M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:4/SegmentKeys:1       207379 ns    
   207241 ns         3384 bytes_per_second=2.3561Gi/s 
items_per_second=158.115M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:16/SegmentKeys:1      254707 ns    
   254565 ns         2777 bytes_per_second=1.9181Gi/s 
items_per_second=128.721M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:64/SegmentKeys:1      439539 ns    
   439415 ns         1589 bytes_per_second=1.11121Gi/s 
items_per_second=74.5719M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:256/SegmentKeys:1    1225127 ns    
  1224517 ns          576 bytes_per_second=408.324Mi/s 
items_per_second=26.7599M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:1/SegmentKeys:2       355268 ns    
   355082 ns         1985 bytes_per_second=1.37512Gi/s 
items_per_second=92.283M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:4/SegmentKeys:2       410702 ns    
   410486 ns         1703 bytes_per_second=1.18952Gi/s 
items_per_second=79.8273M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:16/SegmentKeys:2      667262 ns    
   667087 ns         1035 bytes_per_second=749.527Mi/s 
items_per_second=49.121M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:64/SegmentKeys:2     1087405 ns    
  1086757 ns          651 bytes_per_second=460.084Mi/s 
items_per_second=30.1521M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:256/SegmentKeys:2    2133928 ns    
  2132308 ns          331 bytes_per_second=234.488Mi/s 
items_per_second=15.3674M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:1/SegmentKeys:3       437444 ns    
   437048 ns         1592 bytes_per_second=1.11722Gi/s 
items_per_second=74.9757M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:4/SegmentKeys:3       505824 ns    
   505355 ns         1385 bytes_per_second=989.403Mi/s 
items_per_second=64.8415M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:16/SegmentKeys:3      756347 ns    
   755999 ns          906 bytes_per_second=661.377Mi/s 
items_per_second=43.344M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:64/SegmentKeys:3     1294590 ns    
  1293676 ns          546 bytes_per_second=386.496Mi/s 
items_per_second=25.3294M/s
   BenchmarkRowSegmenter/Rows:32768/Segments:256/SegmentKeys:3    2552917 ns    
  2551420 ns          274 bytes_per_second=195.969Mi/s 
items_per_second=12.843M/s
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to