You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/07/14 02:50:26 UTC

[GitHub] [incubator-doris] acelyc111 commented on pull request #4036: [metrics] Use atomic instead of SpinLock for interger metric

acelyc111 commented on pull request #4036:
URL: https://github.com/apache/incubator-doris/pull/4036#issuecomment-657934940


   > A good job. I found in Apache Impala, it has benchmark the SpinLock and Atomic, It seems have 5 times improvement.
   > Do you have test it? @acelyc111
   
   ```
   [ RUN      ] MetricsTest.CounterPerf
   WARNING: Logging before InitGoogleLogging() is written to STDERR
   I0714 02:38:03.204952 34792 new_metrics_test.cpp:96] int64_t: elapsed: 1142338156ns, ns/iter:11
   I0714 02:38:08.959098 34792 new_metrics_test.cpp:109] IntAtomicCounter: elapsed: 5753794004ns, ns/iter:57
   I0714 02:38:23.468799 34792 new_metrics_test.cpp:122] IntCounter: elapsed: 14509514545ns, ns/iter:145
   I0714 02:38:27.183116 34792 new_metrics_test.cpp:137] IntCounter multi-thread elapsed: 20876844066ns, ns/iter:2609
   I0714 02:38:29.516652 34792 new_metrics_test.cpp:152] IntAtomicCounter multi-thread elapsed: 9994453846ns, ns/iter:1249
   [       OK ] MetricsTest.CounterPerf (27454 ms)
   ```
   According to the simple benchmark in unittest, seems `IntAtomicCounter` is 3 times faster than `IntCounter` (SpinLockCounter) in single thread, and twice faster in multi-thread. @chaoyli 


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org