codeberg.org/gruf/go-mangler@v1.3.0/README.md (about)

     1  # go-mangler
     2  
     3  [Documentation](https://pkg.go.dev/codeberg.org/gruf/go-mangler).
     4  
     5  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.
     6  
     7  It is useful, for example, for use as part of larger abstractions involving hashmaps. That was my particular usecase anyways...
     8  
     9  This package does make liberal use of the "unsafe" package.
    10  
    11  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.
    12  
    13  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.
    14  
    15  ```
    16  go test -run=none -benchmem -gcflags=all='-l=4' -bench=.*                            
    17  goos: linux
    18  goarch: amd64
    19  pkg: codeberg.org/gruf/go-mangler
    20  cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    21  BenchmarkMangle
    22  BenchmarkMangle-8                         877761              1323 ns/op               0 B/op          0 allocs/op
    23  BenchmarkMangleKnown
    24  BenchmarkMangleKnown-8                   1462954               814.5 ns/op             0 B/op          0 allocs/op
    25  BenchmarkJSON
    26  BenchmarkJSON-8                           199930              5910 ns/op            2698 B/op        119 allocs/op
    27  BenchmarkLoosy
    28  BenchmarkLoosy-8                          307575              3718 ns/op             664 B/op         53 allocs/op
    29  BenchmarkBinary
    30  BenchmarkBinary-8                         413216              2640 ns/op            3824 B/op        116 allocs/op
    31  BenchmarkFmt
    32  BenchmarkFmt-8                            133429              8568 ns/op            3010 B/op        207 allocs/op
    33  BenchmarkFxmackerCbor
    34  BenchmarkFxmackerCbor-8                   258562              4268 ns/op            2118 B/op        134 allocs/op
    35  BenchmarkMitchellhHashStructure
    36  BenchmarkMitchellhHashStructure-8          88941             13049 ns/op           10269 B/op       1096 allocs/op
    37  BenchmarkCnfStructhash
    38  BenchmarkCnfStructhash-8                    5586            179537 ns/op          290373 B/op       5863 allocs/op
    39  PASS
    40  ok      codeberg.org/gruf/go-mangler    12.469s
    41  ```