Releases: yunginnanet/common
v1
What's Changed
- Bump codecov/codecov-action from 4.0.1 to 4.5.0 by @dependabot in #36
- Bump golang.org/x/crypto from 0.24.0 to 0.25.0 by @dependabot in #37
- Feat (list): Contains and ContainsDeep by @yunginnanet in #38
Full Changelog: v0.9.9...v1.0.0
v0.9.7 - [hash] crc64
Full Changelog: v0.9.6...v0.9.7
v0.9.2 [entropy] - fix race + performance boost
entropy fixes and overhaul
fix race condition
splitmix64 has a race condition. it likely (usually) doesn't matter all that much, essentially skeeto references a pointer to the instance of splitmix64 directly during the PRNG's regular churn.
in terms of the random values this seems fine, but i missed it because i wasn't using t.Parrallel()
. Downstream packages compiled with the race detector of course threw traces.
the fix involves implementing a sync.Pool
of splitmix64 pointers without breaking the existing API. it doesn't seem to slow things down, in fact if anything it seems to speed up operations and reduce allocations (go figure).
performance
besides the above prng pool, the random string generators have been overhauled, and their performance has dramatically increased in all areas.
look at this shit;
before
goos: linux
goarch: amd64
pkg: git.tcp.direct/kayos/common/entropy
cpu: 13th Gen Intel(R) Core(TM) i9-13900K
Benchmark_RandStr/5char/run1-32 991692 1164 ns/op 336 B/op 17 allocs/op
Benchmark_RandStr/5char/run2-32 1000000 1146 ns/op 336 B/op 17 allocs/op
Benchmark_RandStr/5char/run3-32 1000000 1147 ns/op 336 B/op 17 allocs/op
Benchmark_RandStr/5char/run4-32 990246 1146 ns/op 336 B/op 17 allocs/op
Benchmark_RandStr/25char/run1-32 209188 5661 ns/op 1664 B/op 77 allocs/op
Benchmark_RandStr/25char/run2-32 209958 5661 ns/op 1664 B/op 77 allocs/op
Benchmark_RandStr/25char/run3-32 209828 5743 ns/op 1664 B/op 77 allocs/op
Benchmark_RandStr/25char/run4-32 209623 5655 ns/op 1664 B/op 77 allocs/op
Benchmark_RandStr/55char/run1-32 96064 12418 ns/op 3648 B/op 167 allocs/op
Benchmark_RandStr/55char/run2-32 95988 12428 ns/op 3648 B/op 167 allocs/op
Benchmark_RandStr/55char/run3-32 96433 12423 ns/op 3648 B/op 167 allocs/op
Benchmark_RandStr/55char/run4-32 95943 12418 ns/op 3648 B/op 167 allocs/op
Benchmark_RandStr/500char/run1-32 10000 112782 ns/op 33024 B/op 1502 allocs/op
Benchmark_RandStr/500char/run2-32 10000 114732 ns/op 33024 B/op 1502 allocs/op
Benchmark_RandStr/500char/run3-32 10000 112755 ns/op 33024 B/op 1502 allocs/op
Benchmark_RandStr/500char/run4-32 10000 112990 ns/op 33024 B/op 1502 allocs/op
Benchmark_RandStr/55555char/run1-32 92 12508040 ns/op 3670224 B/op 166667 allocs/op
Benchmark_RandStr/55555char/run2-32 92 12507297 ns/op 3670222 B/op 166667 allocs/op
Benchmark_RandStr/55555char/run3-32 93 12517544 ns/op 3670226 B/op 166667 allocs/op
Benchmark_RandStr/55555char/run4-32 92 12514224 ns/op 3670222 B/op 166667 allocs/op
PASS
ok git.tcp.direct/kayos/common/entropy 24.257s
after
goos: linux
goarch: amd64
pkg: git.tcp.direct/kayos/common/entropy
cpu: 13th Gen Intel(R) Core(TM) i9-13900K
Benchmark_RandStr/5char/run1-32 24768908 48.37 ns/op 21 B/op 2 allocs/op
Benchmark_RandStr/5char/run2-32 24689665 49.21 ns/op 21 B/op 2 allocs/op
Benchmark_RandStr/5char/run3-32 24731571 48.09 ns/op 21 B/op 2 allocs/op
Benchmark_RandStr/5char/run4-32 24766143 48.16 ns/op 21 B/op 2 allocs/op
Benchmark_RandStr/25char/run1-32 11914915 99.61 ns/op 48 B/op 2 allocs/op
Benchmark_RandStr/25char/run2-32 11995597 99.82 ns/op 48 B/op 2 allocs/op
Benchmark_RandStr/25char/run3-32 11996383 99.66 ns/op 48 B/op 2 allocs/op
Benchmark_RandStr/25char/run4-32 11901414 102.3 ns/op 48 B/op 2 allocs/op
Benchmark_RandStr/55char/run1-32 6582032 182.4 ns/op 80 B/op 2 allocs/op
Benchmark_RandStr/55char/run2-32 6563631 182.4 ns/op 80 B/op 2 allocs/op
Benchmark_RandStr/55char/run3-32 6564248 182.3 ns/op 80 B/op 2 allocs/op
Benchmark_RandStr/55char/run4-32 6571722 181.9 ns/op 80 B/op 2 allocs/op
Benchmark_RandStr/500char/run1-32 878709 1297 ns/op 529 B/op 2 allocs/op
Benchmark_RandStr/500char/run2-32 878859 1295 ns/op 529 B/op 2 allocs/op
Benchmark_RandStr/500char/run3-32 879234 1325 ns/op 529 B/op 2 allocs/op
Benchmark_RandStr/500char/run4-32 883886 1296 ns/op 529 B/op 2 allocs/op
Benchmark_RandStr/55555char/run1-32 8374 137120 ns/op 57493 B/op 2 allocs/op
Benchmark_RandStr/55555char/run2-32 8313 137030 ns/op 57493 B/op 2 allocs/op
Benchmark_RandStr/55555char/run3-32 8277 137153 ns/op 57493 B/op 2 allocs/op
Benchmark_RandStr/55555char/run4-32 8287 136919 ns/op 57509 B/op 2 allocs/op
PASS
ok git.tcp.direct/kayos/common/entropy 25.016s
Full Changelog: v0.9.1...v0.9.2
BREAKING: change list.Pop() mechanics
Full Changelog: v0.8.3...v0.8.4