mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 02:21:34 +08:00
51d8b2e359
On my machine I'm getting following results (real time, best of 3): 1 thread 10 threads 100 threads zf_log 0.466s 2.711s 2.608s spdlog 0.747s 5.121s 5.376s
77 lines
2.2 KiB
Bash
Executable File
77 lines
2.2 KiB
Bash
Executable File
#~/bin/bash
|
|
#execute each bench 3 times and print the timing
|
|
|
|
exec 2>&1
|
|
|
|
#execute and time given exe 3 times
|
|
bench_exe ()
|
|
{
|
|
echo "**************** $1 ****************"
|
|
for i in {1..3}; do
|
|
time ./$1 $2;
|
|
rm -f logs/*
|
|
sleep 3
|
|
done;
|
|
}
|
|
|
|
#execute given async tests 3 times (timing is already builtin)
|
|
bench_async ()
|
|
{
|
|
echo "**************** $1 ****************"
|
|
for i in {1..3}; do
|
|
./$1 $2;
|
|
echo
|
|
rm -f logs/*
|
|
sleep 3
|
|
done;
|
|
}
|
|
|
|
|
|
echo "----------------------------------------------------------"
|
|
echo "Single threaded benchmarks.. (1 thread, 1,000,000 lines)"
|
|
echo "----------------------------------------------------------"
|
|
for exe in boost-bench glog-bench easylogging-bench zf_log-bench spdlog-bench;
|
|
do
|
|
bench_exe $exe 1
|
|
done;
|
|
|
|
echo "----------------------------------------------------------"
|
|
echo "Multi threaded benchmarks.. (10 threads, 1,000,000 lines)"
|
|
echo "----------------------------------------------------------"
|
|
for exe in boost-bench-mt glog-bench-mt easylogging-bench-mt zf_log-bench-mt spdlog-bench-mt;
|
|
do
|
|
bench_exe $exe 10
|
|
done;
|
|
|
|
echo "----------------------------------------------------------"
|
|
echo "Multi threaded benchmarks.. (100 threads, 1,000,000 lines)"
|
|
echo "----------------------------------------------------------"
|
|
for exe in boost-bench-mt glog-bench-mt easylogging-bench-mt zf_log-bench-mt spdlog-bench-mt;
|
|
do
|
|
bench_exe $exe 100
|
|
done;
|
|
|
|
echo "---------------------------------------------------------------"
|
|
echo "Async, single threaded benchmark.. (1 thread, 1,000,000 lines)"
|
|
echo "---------------------------------------------------------------"
|
|
for exe in spdlog-async g2log-async
|
|
do
|
|
bench_async $exe 1
|
|
done;
|
|
|
|
echo "---------------------------------------------------------------"
|
|
echo "Async, multi threaded benchmark.. (10 threads, 1,000,000 lines)"
|
|
echo "---------------------------------------------------------------"
|
|
for exe in spdlog-async g2log-async
|
|
do
|
|
bench_async $exe 10
|
|
done;
|
|
|
|
echo "---------------------------------------------------------------"
|
|
echo "Async, multi threaded benchmark.. (100 threads, 1,000,000 lines)"
|
|
echo "---------------------------------------------------------------"
|
|
for exe in spdlog-async g2log-async
|
|
do
|
|
bench_async $exe 100
|
|
done;
|