File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed
Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -130,14 +130,25 @@ type FixedArray struct {
130130## Performance Benchmarks
131131
132132```
133- $ go test -benchmem -run=^$ -bench .
133+ goos: windows
134+ goarch: amd64
135+ pkg: github.com/shengyanli1982/struc/v2
136+ cpu: 12th Gen Intel(R) Core(TM) i5-12400F
134137BenchmarkArrayEncode-12 3203236 373.2 ns/op 137 B/op 4 allocs/op
138+ BenchmarkSliceEncode-12 2985786 400.9 ns/op 137 B/op 4 allocs/op
139+ BenchmarkArrayDecode-12 3407203 349.8 ns/op 73 B/op 2 allocs/op
140+ BenchmarkSliceDecode-12 2768002 433.5 ns/op 112 B/op 4 allocs/op
141+ BenchmarkEncode-12 2656374 462.5 ns/op 168 B/op 4 allocs/op
135142BenchmarkStdlibEncode-12 6035904 206.0 ns/op 136 B/op 3 allocs/op
136143BenchmarkManualEncode-12 49696231 25.64 ns/op 64 B/op 1 allocs/op
144+ BenchmarkDecode-12 2812420 421.0 ns/op 103 B/op 2 allocs/op
145+ BenchmarkStdlibDecode-12 5953122 195.3 ns/op 80 B/op 3 allocs/op
146+ BenchmarkManualDecode-12 100000000 12.21 ns/op 8 B/op 1 allocs/op
147+ BenchmarkFullEncode-12 1000000 1800 ns/op 456 B/op 4 allocs/op
148+ BenchmarkFullDecode-12 598369 1974 ns/op 327 B/op 5 allocs/op
149+ BenchmarkFieldPool-12 19483657 62.86 ns/op 168 B/op 4 allocs/op
137150```
138151
139- Our benchmarks provide transparent performance metrics for different encoding approaches. While reflection-based solutions typically trade some performance for flexibility and features, ` struc ` maintains competitive performance while offering rich functionality.
140-
141152## License
142153
143154MIT License - see LICENSE file for details
Original file line number Diff line number Diff line change @@ -130,14 +130,25 @@ type FixedArray struct {
130130## 性能基准测试
131131
132132```
133- $ go test -benchmem -run=^$ -bench .
133+ goos: windows
134+ goarch: amd64
135+ pkg: github.com/shengyanli1982/struc/v2
136+ cpu: 12th Gen Intel(R) Core(TM) i5-12400F
134137BenchmarkArrayEncode-12 3203236 373.2 ns/op 137 B/op 4 allocs/op
138+ BenchmarkSliceEncode-12 2985786 400.9 ns/op 137 B/op 4 allocs/op
139+ BenchmarkArrayDecode-12 3407203 349.8 ns/op 73 B/op 2 allocs/op
140+ BenchmarkSliceDecode-12 2768002 433.5 ns/op 112 B/op 4 allocs/op
141+ BenchmarkEncode-12 2656374 462.5 ns/op 168 B/op 4 allocs/op
135142BenchmarkStdlibEncode-12 6035904 206.0 ns/op 136 B/op 3 allocs/op
136143BenchmarkManualEncode-12 49696231 25.64 ns/op 64 B/op 1 allocs/op
144+ BenchmarkDecode-12 2812420 421.0 ns/op 103 B/op 2 allocs/op
145+ BenchmarkStdlibDecode-12 5953122 195.3 ns/op 80 B/op 3 allocs/op
146+ BenchmarkManualDecode-12 100000000 12.21 ns/op 8 B/op 1 allocs/op
147+ BenchmarkFullEncode-12 1000000 1800 ns/op 456 B/op 4 allocs/op
148+ BenchmarkFullDecode-12 598369 1974 ns/op 327 B/op 5 allocs/op
149+ BenchmarkFieldPool-12 19483657 62.86 ns/op 168 B/op 4 allocs/op
137150```
138151
139- 我们的基准测试为不同的编码方法提供了透明的性能指标。虽然基于反射的解决方案通常会用一些性能来换取灵活性和功能,但 ` struc ` 在提供丰富功能的同时保持了具有竞争力的性能表现。
140-
141152## 许可证
142153
143154MIT 许可证 - 详见 LICENSE 文件
You can’t perform that action at this time.
0 commit comments