Skip to content

Commit

Permalink
docs(test-stdlog): update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ozoniuss committed May 5, 2023
1 parent 068e3f1 commit 824d363
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test-stdlog/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
This was just a test I run to see the overhead generated by creating a logger using Go's standard log library for every log message. The code spawns a number of different threads that each print the same number of messages, and does this once using fmt and once using [my custom](https://github.com/Ozoniuss/stdlog) logging package. It turns out that the difference is insignificant and has determined me to stick with my approach.
> Note (05/05/2023): I wrote this quite a while back, before getting deeper into Go benchmarking. This is likely not how I would benchmark this now, but it's still a good test which makes me comfortable using my logging package in small personal-projects.
This was just a test I run to see the overhead generated by creating a logger using Go's standard log library for every log message. The code spawns a number of different goroutines that each print the same number of messages, and does this once using fmt and once using [my custom](https://github.com/Ozoniuss/stdlog) logging package. It turns out that the difference is insignificant and has determined me to stick with my approach.

Sample written message:

```
[info] 2023/02/17 20:23:59 [something]
```

Sample runs 1000 threads, 100 messages per thread (after reboot, which seems to have sped up the execution by 10 seconds...):
Sample runs 1000 goroutines, 100 messages per thread (after reboot, which seems to have sped up the execution by 10 seconds...):

```
printalot: 10.6862847s, logalot: 9.8260375s
printalot: 9.5667713s, logalot: 9.7314287s
printalot: 9.7145407s, logalot: 9.7401294s
```

Sample run 1000 threads, 1000 messages per thread:
Sample run 1000 goroutines, 1000 messages per thread:

```
printalot: 2m54.368541s, logalot: 3m0.1742913s (prior to reboot)
Expand Down

0 comments on commit 824d363

Please sign in to comment.