Skip to content

Commit

Permalink
Merge pull request #4 from PragmaticEngineering/feature/kvstore
Browse files Browse the repository at this point in the history
adding benchmark data
  • Loading branch information
James Rhoat authored Mar 14, 2024
2 parents 0d430b6 + 5e1f3d4 commit aea6100
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,24 @@ Keys are fairly flexible, and can hold more or less any string value. For best c
- While key names are mostly unrestricted (and spaces are acceptable), it's generally a good idea to stick to printable ascii characters, or at least match the general character set of your log lines.

## Why should keys be constant values?
The point of structured logging is to make later log processing easier. Your keys are, effectively, the schema of each log message. If you use different keys across instances of the same log line, you will make your structured logs much harder to use. Sprintf() is for values, not for keys!
The point of structured logging is to make later log processing easier. Your keys are, effectively, the schema of each log message. If you use different keys across instances of the same log line, you will make your structured logs much harder to use. Sprintf() is for values, not for keys!

## Benchmark results
```shell
goos: windows
goarch: amd64
pkg: github.com/pragmaticengineering/pectx
cpu: AMD Ryzen 7 5800X 8-Core Processor
BenchmarkManager_Set/manager_with_1_field-16 11193685 107.3 ns/op 80 B/op 3 allocs/op
BenchmarkManager_Set/manager_with_10_fields-16 4508931 268.3 ns/op 80 B/op 3 allocs/op
BenchmarkManager_Set/manager_with_100_fields-16 514476 2341 ns/op 80 B/op 3 allocs/op
BenchmarkManager_Get/context_with_1_field-16 52671543 21.71 ns/op 16 B/op 1 allocs/op
BenchmarkManager_Get/context_with_10_fields-16 53259243 21.66 ns/op 16 B/op 1 allocs/op
BenchmarkManager_Get/context_with_100_fields-16 54336505 21.80 ns/op 16 B/op 1 allocs/op
BenchmarkManager_GetKeysAndValues/context_with_1_field-16 50881305 24.10 ns/op 16 B/op 1 allocs/op
BenchmarkManager_GetKeysAndValues/context_with_10_fields-16 49886922 23.85 ns/op 16 B/op 1 allocs/op
BenchmarkManager_GetKeysAndValues/context_with_100_fields-16 50965585 23.56 ns/op 16 B/op 1 allocs/op
BenchmarkKeysAndValues_forloop/Set_1_key-value_pair-16 11087672 110.0 ns/op 64 B/op 3 allocs/op
BenchmarkKeysAndValues_forloop/Set_10_key-value_pairs-16 3255266 373.7 ns/op 544 B/op 3 allocs/op
BenchmarkKeysAndValues_forloop/Set_100_key-value_pairs-16 469452 2538 ns/op 5264 B/op 3 allocs/op
```

0 comments on commit aea6100

Please sign in to comment.