Skip to content

Instantly share code, notes, and snippets.

@Araeos
Last active February 4, 2020 02:03
Show Gist options
  • Save Araeos/e2becdd88d07698c49b78d0756e60bdd to your computer and use it in GitHub Desktop.
Save Araeos/e2becdd88d07698c49b78d0756e60bdd to your computer and use it in GitHub Desktop.
spdlog benchmark of the asynchronous logging facilities.
Results using the default details::mpmc_blocking_queue implementation:
$ bench
[info] **************************************************************
[info] Single threaded: 1000000 messages
[info] **************************************************************
[info] basic_st Elapsed: 0.45 secs 2239158/sec
[info] basic_st/backtrace-on Elapsed: 0.45 secs 2225987/sec
[info]
[info] rotating_st Elapsed: 0.44 secs 2293912/sec
[info] rotating_st/backtrace-on Elapsed: 0.54 secs 1863870/sec
[info]
[info] daily_st Elapsed: 0.45 secs 2210196/sec
[info] daily_st/backtrace-on Elapsed: 0.58 secs 1722478/sec
[info]
[info] level-off Elapsed: 0.01 secs 91225893/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5963153/sec
[info] **************************************************************
[info] Multi threaded: 1 threads, 1000000 messages
[info] **************************************************************
[info] basic_mt Elapsed: 0.41 secs 2458098/sec
[info] basic_mt/backtrace-on Elapsed: 0.52 secs 1913274/sec
[info]
[info] rotating_mt Elapsed: 0.45 secs 2238492/sec
[info] rotating_mt/backtrace-on Elapsed: 0.55 secs 1834836/sec
[info]
[info] daily_mt Elapsed: 0.48 secs 2074991/sec
[info] daily_mt/backtrace-on Elapsed: 0.61 secs 1650765/sec
[info]
[info] level-off Elapsed: 0.01 secs 91303355/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5953142/sec
[info] **************************************************************
[info] Multi threaded: 10 threads, 1000000 messages
[info] **************************************************************
[info] basic_mt Elapsed: 1.05 secs 950041/sec
[info] basic_mt/backtrace-on Elapsed: 1.24 secs 808635/sec
[info]
[info] rotating_mt Elapsed: 1.02 secs 977636/sec
[info] rotating_mt/backtrace-on Elapsed: 1.26 secs 791752/sec
[info]
[info] daily_mt Elapsed: 1.11 secs 900860/sec
[info] daily_mt/backtrace-on Elapsed: 1.35 secs 739431/sec
[info]
[info] level-off Elapsed: 0.01 secs 88594361/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5974768/sec
[info] **************************************************************
[info] Async threaded: 1 threads, 1000000 messages
[info] **************************************************************
[info] basic_mt Elapsed: 0.79 secs 1259206/sec
[info] basic_mt/backtrace-on Elapsed: 0.76 secs 1309694/sec
[info]
[info] rotating_mt Elapsed: 1.00 secs 1002389/sec
[info] rotating_mt/backtrace-on Elapsed: 0.87 secs 1146728/sec
[info]
[info] daily_mt Elapsed: 0.84 secs 1197042/sec
[info] daily_mt/backtrace-on Elapsed: 1.23 secs 813227/sec
[info]
[info] level-off Elapsed: 0.01 secs 90507566/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5777040/sec
[info] **************************************************************
[info] Async threaded: 10 threads, 1000000 messages
[info] **************************************************************
[info] basic_mt Elapsed: 2.56 secs 390791/sec
[info] basic_mt/backtrace-on Elapsed: 2.73 secs 366941/sec
[info]
[info] rotating_mt Elapsed: 2.72 secs 367184/sec
[info] rotating_mt/backtrace-on Elapsed: 2.73 secs 366426/sec
[info]
[info] daily_mt Elapsed: 2.72 secs 368253/sec
[info] daily_mt/backtrace-on Elapsed: 2.80 secs 357169/sec
[info]
[info] level-off Elapsed: 0.01 secs 91195943/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5886414/sec
$ async_bench 100000 10 16384
[info] -------------------------------------------------
[info] Messages : 100000
[info] Threads : 10
[info] Queue : 16384 slots
[info] Queue memory : 16384 x 408 = 6528 KB
[info] Total iters : 3
[info] -------------------------------------------------
[info]
[info] *********************************
[info] Queue Overflow Policy: block
[info] *********************************
[info] Elapsed: 0.2474439 secs 404132/sec
[info] Elapsed: 0.2545365 secs 392870/sec
[info] Elapsed: 0.2620494 secs 381607/sec
[info]
[info] *********************************
[info] Queue Overflow Policy: overrun
[info] *********************************
[info] Elapsed: 0.0734599 secs 1361286/sec
[info] Elapsed: 0.0630372 secs 1586364/sec
[info] Elapsed: 0.068806 secs 1453361/sec
Using the MPMCQueueAdapter for the lock-free queue:
$ bench
[info] **************************************************************
[info] Single threaded: 1000000 messages
[info] **************************************************************
[info] basic_st Elapsed: 0.44 secs 2248376/sec
[info] basic_st/backtrace-on Elapsed: 0.45 secs 2212065/sec
[info]
[info] rotating_st Elapsed: 0.45 secs 2217191/sec
[info] rotating_st/backtrace-on Elapsed: 0.52 secs 1921949/sec
[info]
[info] daily_st Elapsed: 0.48 secs 2092311/sec
[info] daily_st/backtrace-on Elapsed: 0.56 secs 1790947/sec
[info]
[info] level-off Elapsed: 0.01 secs 91545749/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5896960/sec
[info] **************************************************************
[info] Multi threaded: 1 threads, 1000000 messages
[info] **************************************************************
[info] basic_mt Elapsed: 0.42 secs 2395124/sec
[info] basic_mt/backtrace-on Elapsed: 0.50 secs 2008585/sec
[info]
[info] rotating_mt Elapsed: 0.45 secs 2242889/sec
[info] rotating_mt/backtrace-on Elapsed: 0.53 secs 1874618/sec
[info]
[info] daily_mt Elapsed: 0.51 secs 1960067/sec
[info] daily_mt/backtrace-on Elapsed: 0.60 secs 1663742/sec
[info]
[info] level-off Elapsed: 0.01 secs 91727971/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5878338/sec
[info] **************************************************************
[info] Multi threaded: 10 threads, 1000000 messages
[info] **************************************************************
[info] basic_mt Elapsed: 0.98 secs 1019659/sec
[info] basic_mt/backtrace-on Elapsed: 1.30 secs 771440/sec
[info]
[info] rotating_mt Elapsed: 1.28 secs 782557/sec
[info] rotating_mt/backtrace-on Elapsed: 1.29 secs 775766/sec
[info]
[info] daily_mt Elapsed: 1.14 secs 879411/sec
[info] daily_mt/backtrace-on Elapsed: 1.42 secs 701857/sec
[info]
[info] level-off Elapsed: 0.01 secs 87978603/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5913968/sec
[info] **************************************************************
[info] Async threaded: 1 threads, 1000000 messages
[info] **************************************************************
[info] basic_mt Elapsed: 0.50 secs 2004096/sec
[info] basic_mt/backtrace-on Elapsed: 0.55 secs 1823456/sec
[info]
[info] rotating_mt Elapsed: 0.56 secs 1781594/sec
[info] rotating_mt/backtrace-on Elapsed: 0.50 secs 1983008/sec
[info]
[info] daily_mt Elapsed: 0.49 secs 2053135/sec
[info] daily_mt/backtrace-on Elapsed: 0.66 secs 1514018/sec
[info]
[info] level-off Elapsed: 0.01 secs 91315027/sec
[info] level-off/backtrace-on Elapsed: 0.17 secs 5934210/sec
[info] **************************************************************
[info] Async threaded: 10 threads, 1000000 messages
[info] **************************************************************
[info] basic_mt Elapsed: 0.62 secs 1604676/sec
[info] basic_mt/backtrace-on Elapsed: 0.79 secs 1261591/sec
[info]
[info] rotating_mt Elapsed: 0.71 secs 1415312/sec
[info] rotating_mt/backtrace-on Elapsed: 0.66 secs 1518434/sec
[info]
[info] daily_mt Elapsed: 0.73 secs 1378370/sec
[info] daily_mt/backtrace-on Elapsed: 0.73 secs 1375201/sec
[info]
[info] level-off Elapsed: 0.01 secs 80981495/sec
[info] level-off/backtrace-on Elapsed: 0.18 secs 5644140/sec
$ async_bench 100000 10 16384
[info] -------------------------------------------------
[info] Messages : 100000
[info] Threads : 10
[info] Queue : 16384 slots
[info] Queue memory : 16384 x 408 = 6528 KB
[info] Total iters : 3
[info] -------------------------------------------------
[info]
[info] *********************************
[info] Queue Overflow Policy: block
[info] *********************************
[info] Elapsed: 0.0759197 secs 1317181/sec
[info] Elapsed: 0.0753555 secs 1327043/sec
[info] Elapsed: 0.0677987 secs 1474954/sec
[info]
[info] *********************************
[info] Queue Overflow Policy: overrun
[info] *********************************
[info] Elapsed: 0.0217206 secs 4603924/sec
[info] Elapsed: 0.021157 secs 4726568/sec
[info] Elapsed: 0.023545 secs 4247186/sec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment