Files
undead-logging/BENCH.md
zombieb 44784130f9 README fixes, new RoundedLocal time format, more local source options
* i wanted to make sure `undefined` was handled properly. seems like it is.
* tested with Bun, works. Deno runs faster though, by about 1.8µs/message construction!
* Removed skeletons from closet (bug fixes)
* Sources can now optionally specify their own time format and/or log timing
* Requests and Responses now can be converted and displayed (no bodies)
2025-07-19 05:00:07 -04:00

2.1 KiB

Benchmarks

<-- Back to README

Deno 2.4.1 can't find my CPU for some reason.

Ran with an AMD Ryzen 7 5800X @ 3.6GHz

benchmark/deno.ts:

| benchmark   | time/iter (avg) |        iter/s |      (min … max)      |      p75 |      p99 |     p995 |
| ----------- | --------------- | ------------- | --------------------- | -------- | -------- | -------- |

group timing-sync
| 1 Log       |          1.6 µs |       643,000 | (  1.5 µs …   1.9 µs) |   1.5 µs |   1.9 µs |   1.9 µs |
| 100 Logs    |        153.4 µs |         6,520 | (147.1 µs … 279.5 µs) | 150.2 µs | 229.9 µs | 234.5 µs |
| 1k Logs     |          1.5 ms |         650.2 | (  1.5 ms …   1.7 ms) |   1.6 ms |   1.7 ms |   1.7 ms |
| 10k Logs    |         15.4 ms |          65.0 | ( 15.2 ms …  16.1 ms) |  15.4 ms |  16.1 ms |  16.1 ms |
| 100k Logs   |        153.5 ms |           6.5 | (152.9 ms … 154.8 ms) | 153.7 ms | 154.8 ms | 154.8 ms |

summary
  1 Log
    98.62x faster than 100 Logs
   989.00x faster than 1k Logs
     9887x faster than 10k Logs
    98680x faster than 100k Logs

group timing-deferred
| 1 Log       |          1.6 µs |       644,200 | (  1.5 µs …   1.6 µs) |   1.6 µs |   1.6 µs |   1.6 µs |
| 100 Logs    |        153.2 µs |         6,525 | (147.5 µs … 269.1 µs) | 150.6 µs | 228.1 µs | 230.8 µs |
| 1k Logs     |          1.5 ms |         653.9 | (  1.5 ms …   1.7 ms) |   1.6 ms |   1.6 ms |   1.6 ms |
| 10k Logs    |         15.3 ms |          65.3 | ( 15.2 ms …  15.7 ms) |  15.3 ms |  15.7 ms |  15.7 ms |
| 100k Logs   |        153.7 ms |           6.5 | (152.9 ms … 155.9 ms) | 154.0 ms | 155.9 ms | 155.9 ms |

summary
  1 Log
    98.72x faster than 100 Logs
   985.10x faster than 1k Logs
     9865x faster than 10k Logs
    99040x faster than 100k Logs

TL;DR / What does this mean?

You can, in theory and on average, construct 650,000 messages per second.

I don't know how to benchmark a logger without logging messages to stdout,
so I created a dedicated bench function on each source that just constructs them.

Deferred is not really much faster, but can be helpful in some scenarios. I think. Maybe.