[chore] update go-structr and go-mangler to no longer rely on modern-go/reflect2 (#3026)

* updates go-structr and go-mangler to no longer rely on modern-go/reflect2 (*phew* now we're go1.23 safe)

* update go-structr version

* bump go-structr to improve memory usage (v. slightly) in certain conditions
This commit is contained in:
kim 2024-06-21 15:43:17 +00:00 committed by GitHub
commit b93087ceb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 346 additions and 490 deletions

View file

@ -2,13 +2,13 @@
[Documentation](https://pkg.go.dev/codeberg.org/gruf/go-mangler).
To put it simply is a bit of an odd library. It aims to provide incredibly fast, unique string outputs for all default supported input data types during a given runtime instance.
To put it simply is a bit of an odd library. It aims to provide incredibly fast, unique string outputs for all default supported input data types during a given runtime instance. See `mangler.String()`for supported types.
It is useful, for example, for use as part of larger abstractions involving hashmaps. That was my particular usecase anyways...
This package does make liberal use of the "unsafe" package.
Benchmarks are below. Those with missing values panicked during our set of benchmarks, usually a case of not handling nil values elegantly. Please note the more important thing to notice here is the relative difference in benchmark scores, the actual `ns/op`,`B/op`,`allocs/op` accounts for running through over 80 possible test cases, including some not-ideal situations.
Benchmarks are below. Please note the more important thing to notice here is the relative difference in benchmark scores, the actual `ns/op`,`B/op`,`allocs/op` accounts for running through ~80 possible test cases, including some not-ideal situations.
The choice of libraries in the benchmark are just a selection of libraries that could be used in a similar manner to this one, i.e. serializing in some manner.
@ -18,24 +18,14 @@ goos: linux
goarch: amd64
pkg: codeberg.org/gruf/go-mangler
cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
BenchmarkMangle
BenchmarkMangle-8 877761 1323 ns/op 0 B/op 0 allocs/op
BenchmarkMangleKnown
BenchmarkMangleKnown-8 1462954 814.5 ns/op 0 B/op 0 allocs/op
BenchmarkJSON
BenchmarkJSON-8 199930 5910 ns/op 2698 B/op 119 allocs/op
BenchmarkLoosy
BenchmarkLoosy-8 307575 3718 ns/op 664 B/op 53 allocs/op
BenchmarkBinary
BenchmarkBinary-8 413216 2640 ns/op 3824 B/op 116 allocs/op
BenchmarkFmt
BenchmarkFmt-8 133429 8568 ns/op 3010 B/op 207 allocs/op
BenchmarkFxmackerCbor
BenchmarkFxmackerCbor-8 258562 4268 ns/op 2118 B/op 134 allocs/op
BenchmarkMitchellhHashStructure
BenchmarkMitchellhHashStructure-8 88941 13049 ns/op 10269 B/op 1096 allocs/op
BenchmarkCnfStructhash
BenchmarkCnfStructhash-8 5586 179537 ns/op 290373 B/op 5863 allocs/op
BenchmarkMangle-8 1278526 966.0 ns/op 0 B/op 0 allocs/op
BenchmarkMangleKnown-8 3443587 345.9 ns/op 0 B/op 0 allocs/op
BenchmarkJSON-8 228962 4717 ns/op 1849 B/op 99 allocs/op
BenchmarkLoosy-8 307194 3447 ns/op 776 B/op 65 allocs/op
BenchmarkFmt-8 150254 7405 ns/op 1377 B/op 143 allocs/op
BenchmarkFxmackerCbor-8 364411 3037 ns/op 1224 B/op 105 allocs/op
BenchmarkMitchellhHashStructure-8 102272 11268 ns/op 8996 B/op 1000 allocs/op
BenchmarkCnfStructhash-8 6789 168703 ns/op 288301 B/op 5779 allocs/op
PASS
ok codeberg.org/gruf/go-mangler 12.469s
ok codeberg.org/gruf/go-mangler 11.715s
```