Skip to content

iamazeem/spdlog-vs-zlog

Repository files navigation

spdlog-vs-zlog

ci

spdlog vs zlog benchmarks

Tested on Linux and macOS runners via CI. See the most recent run under Actions tab for the latest results.

Scenario

Comparing spdlog and zlog in multithreaded context with file rotation.

Default Parameters

  • Threads: 10
  • Iterations: 1,000,000 (100,000 per thread)
  • Rotation: 10 MB (5 files)
  • Optimization Level: O3

Setup

Clone:

git clone --recursive https://github.com/iamazeem/spdlog-vs-zlog.git
cd spdlog-vs-zlog

Build zlog :

cd zlog
make PREFIX=$PWD/build
make PREFIX=$PWD/build install
cd ..

Build

cmake -S . -B build
cmake --build build

or,

mkdir build
cd build
cmake ..
make

Run

$ cd build
$ ./spdlog-vs-zlog
[2024-02-06 15:05:17.122] [info] threads: 10, iterations: 100,000 per thread
[2024-02-06 15:05:18.910] [info] spdlog, elapsed time:   1.79 secs, logs/sec:     55,925/sec
[2024-02-06 15:06:46.941] [info]   zlog, elapsed time:  88.03 secs, logs/sec:      1,135/sec
[2024-02-06 15:08:13.512] [info]  dzlog, elapsed time:  86.57 secs, logs/sec:      1,155/sec

The rotated log files are generated under /tmp directory:

ls /tmp/{spdlog,zlog,dzlog}*

The CI workflow removes these log files after each iteration:

for i in {1..5}; do
    echo "Run $i"
    ./spdlog-vs-zlog
    echo
    rm /tmp/{spdlog,zlog,dzlog}*
done

License

MIT