loguru
loguru copied to clipboard
Benchmarks
Hi, Do u have benchmarks versus aiologger, standard logger and etc? Looking for fast logging and would like to know if loguru is fast enough
No official benchmarks, but Loguru is not the best candidate for fast logging (yet).
It's currently slower than standard logging.
$ python -m timeit -n 10000 -s "import io,logging;logger=logging.getLogger('test');logger.addHandler(logging.StreamHandler(io.StringIO()))" "logger.warning('.')"
10000 loops, best of 5: 34.4 usec per loop
$ python -m timeit -n 10000 -s "from loguru import logger;import io;logger.remove();logger.add(io.StringIO(),format='{message}')" "logger.warning('.')"
10000 loops, best of 5: 43.1 usec per loop
Out of curiosity what are the major hurdles you see to it being the best candidate for fast logging? Adding a benchmark test suite could help evaluate change impacts moving forward. (Just my two cents)
@matroscoe To achieve maximum performance, Loguru needs to be partially re-implemented using the C Python API. Before that, I'd like to release a v0.7.0 with some improvements and breaking changes. At this point I think the Loguru API will be finalized, so it will be easier to code it in C.
A benchmark suite would be interesting, maybe I'll add one. However, measuring performance is not a trivial matter, as the environment has a great influence on the measurements and can cause unreliable results.