Skip to content

Conversation

@bep
Copy link
Owner

@bep bep commented Aug 7, 2022

  • Make Fields a slice
  • Split Entry into Entry and EntryFields
  • Delay merging fields until they're used
name              old time/op    new time/op    delta
Logger_small-10      109ns ± 6%      80ns ±20%  -26.67%  (p=0.029 n=4+4)
Logger_medium-10     335ns ± 0%     175ns ± 0%  -47.76%  (p=0.029 n=4+4)
Logger_large-10     1.11µs ± 0%    0.41µs ± 0%  -62.76%  (p=0.029 n=4+4)

name              old alloc/op   new alloc/op   delta
Logger_small-10       272B ± 0%       96B ± 0%  -64.71%  (p=0.029 n=4+4)
Logger_medium-10      904B ± 0%      312B ± 0%  -65.49%  (p=0.029 n=4+4)
Logger_large-10     2.47kB ± 0%    1.26kB ± 0%  -49.15%  (p=0.029 n=4+4)

name              old allocs/op  new allocs/op  delta
Logger_small-10       3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.029 n=4+4)
Logger_medium-10      7.00 ± 0%      5.00 ± 0%  -28.57%  (p=0.029 n=4+4)
Logger_large-10       19.0 ± 0%      10.0 ± 0%  -47.37%  (p=0.029 n=4+4)
bep added 2 commits August 7, 2022 17:50
To preserve the log order.

This also improves performance.
Also remove the now incompatible Trace method.

This is easier to reason about and saves some memory allocations:

```bash
name              old time/op    new time/op    delta
Logger_small-10     84.1ns ± 4%    81.6ns ± 4%     ~     (p=0.200 n=4+4)
Logger_medium-10     234ns ± 0%     217ns ± 0%   -6.86%  (p=0.029 n=4+4)
Logger_large-10      623ns ± 1%     583ns ± 0%   -6.38%  (p=0.029 n=4+4)

name              old alloc/op   new alloc/op   delta
Logger_small-10       224B ± 0%      144B ± 0%  -35.71%  (p=0.029 n=4+4)
Logger_medium-10      536B ± 0%      456B ± 0%  -14.93%  (p=0.029 n=4+4)
Logger_large-10     1.86kB ± 0%    1.69kB ± 0%   -9.44%  (p=0.029 n=4+4)

name              old allocs/op  new allocs/op  delta
Logger_small-10       2.00 ± 0%      2.00 ± 0%     ~     (all equal)
Logger_medium-10      6.00 ± 0%      6.00 ± 0%     ~     (all equal)
Logger_large-10       11.0 ± 0%      11.0 ± 0%     ~     (all equal)
```
@bep bep force-pushed the feat/field-slice branch 3 times, most recently from 2f8e106 to a1578fa Compare August 7, 2022 16:35
Also fix a newly introduced logic issue in the merge making the tests pass.
@bep bep force-pushed the feat/field-slice branch from a1578fa to b8c052c Compare August 7, 2022 16:41
@bep bep merged commit eed39f3 into master Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants