Commit def6fc62 authored by gabime's avatar gabime

updated benchmarks

parent 54b86812
......@@ -37,10 +37,12 @@ Just copy the files to your build tree and use a C++11 compiler
Below are some [benchmarks](bench) comparing the time needed to log 1,000,000 lines to file under Ubuntu 64 bit, Intel i7-4770 CPU @ 3.40GHz:
|threads|boost log|glog|g2log|spdlog|
|threads|boost log|glog|g2log|spdlog|spdlog<sup>async mode</sup>|
|-------|:-------:|:-----:|------:|------:|
|1|4.223s|1.084s|3.104s|0.998s|
|10|14.141s|4.204s|3.412s|0.987s|
|1|4.430s|1.115s|3.227s|0.940s|1.574s
|10|13.985s|2.027s|3.476s|3.822s|1.972
## Usage Example
......
Running benchmakrs (all with 1000,000 writes to the logs folder
boost-bench (single thread)..
real 0m4.430s
user 0m4.359s
sys 0m0.072s
glog-bench (single thread)..
real 0m1.115s
user 0m0.997s
sys 0m0.117s
g2log-bench (single thread)..
Exiting, log location: logs/g2log-bench.g2log.20141124-232519.log
real 0m3.277s
user 0m4.189s
sys 0m1.021s
spdlog-bench (single thread)
real 0m0.940s
user 0m0.892s
sys 0m0.048s
------------------------------------
Multithreaded benchmarks..
------------------------------------
boost-bench-mt (10 threads, single logger)..
real 0m13.985s
user 0m35.045s
sys 0m7.196s
glog-bench-mt (10 threads, single logger)..
real 0m2.027s
user 0m5.552s
sys 0m6.223s
g2log-bench-mt (10 threads, single logger)..
Exiting, log location: logs/g2log-bench-mt.g2log.20141124-232551.log
real 0m3.476s
user 0m7.649s
sys 0m1.619s
spdlog-bench-mt (10 threads, single logger)..
real 0m3.822s
user 0m14.233s
sys 0m6.117s
------------------------------------
Async benchmarks..
------------------------------------
spdlog-bench-async (single thread)..
real 0m1.574s
user 0m2.613s
sys 0m0.405s
spdlog-bench-mt-async (10 threads, single logger)..
real 0m1.972s
user 0m3.965s
sys 0m2.747s
......@@ -24,7 +24,9 @@ time ./spdlog-bench
echo
echo
sleep 3
echo "------------------------------------"
echo "Multithreaded benchmarks.."
echo "------------------------------------"
echo "boost-bench-mt (10 threads, single logger)"..
time ./boost-bench-mt
echo
......@@ -49,6 +51,16 @@ echo
echo
sleep 3
echo "------------------------------------"
echo "Async benchmarks.."
echo "------------------------------------"
echo "spdlog-bench-async (single thread)"..
time ./spdlog-bench-async
echo
echo
sleep 3
echo "spdlog-bench-mt-async (10 threads, single logger)"..
time ./spdlog-bench-mt-async
......
......@@ -6,7 +6,7 @@ int main(int, char* [])
{
int howmany = 1000000;
namespace spd = spdlog;
spd::set_async_mode(howmany, std::chrono::seconds(0));
spd::set_async_mode(2500, std::chrono::seconds(0));
///Create a file rotating logger with 5mb size max and 3 rotated files
auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5);
......
......@@ -17,7 +17,7 @@ int main(int argc, char* argv[])
int howmany = 1000000;
namespace spd = spdlog;
spd::set_async_mode(howmany, std::chrono::seconds(0));
spd::set_async_mode(2500, std::chrono::seconds(0));
///Create a file rotating logger with 5mb size max and 3 rotated files
auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5);
......
......@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
int howmany = 1000000;
int threads = 10;
int flush_interval = 1000;
int flush_interval = 0;
int file_size = 30 * 1024 * 1024;
int rotating_files = 5;
......@@ -63,7 +63,7 @@ int main(int argc, char* argv[])
howmany = atoi(argv[1]);
if (argc > 2)
threads = atoi(argv[2]);
/*
cout << "*******************************************************************************\n";
cout << "Single thread, " << format(howmany) << " iterations, flush every " << flush_interval << " lines"<< endl;
cout << "*******************************************************************************\n";
......@@ -88,14 +88,13 @@ int main(int argc, char* argv[])
cout << "\n*******************************************************************************\n";
cout << "async logging.. " << threads << " threads sharing same logger, " << format(howmany) << " iterations, flush every " << flush_interval << " lines" << endl;
cout << "*******************************************************************************\n";
e cout << "*******************************************************************************\n";
*/
spdlog::set_async_mode(howmany);
auto rotating_st_async = spdlog::rotating_logger_st("rotating_async", "logs/rotating_async", file_size, rotating_files, flush_interval);
bench(howmany, rotating_st_async);
spdlog::set_async_mode(2500);
auto daily_st_async = spdlog::daily_logger_st("daily_async", "logs/daily_async", flush_interval);
bench(howmany, daily_st_async);
bench(howmany, spdlog::create<null_sink_st>("null_async"));
bench_mt(howmany, daily_st_async, threads);
spdlog::stop();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment