2024-09-19 20:54:54 +03:00
|
|
|
# goapiperf
|
|
|
|
|
|
|
|
Benchmarks comparing jsoniter VS encoding/json and HTTP reuse
|
|
|
|
|
|
|
|
## Results (on my own hardware):
|
|
|
|
|
|
|
|
HTTP reuse:
|
|
|
|
```
|
|
|
|
goos: linux
|
|
|
|
goarch: amd64
|
|
|
|
pkg: apiSpeedImprove/httpReuse
|
|
|
|
cpu: AMD Ryzen 5 7640U w/ Radeon 760M Graphics
|
2024-09-19 20:56:03 +03:00
|
|
|
BenchmarkNewHttpClientEachRequest-12 3360 300058 ns/op
|
|
|
|
BenchmarkReuseHttpClient-12 6470 175472 ns/op
|
2024-09-19 20:54:54 +03:00
|
|
|
PASS
|
2024-09-19 20:56:03 +03:00
|
|
|
ok apiSpeedImprove/httpReuse 4.010s
|
2024-09-19 20:54:54 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
jsoniter:
|
|
|
|
```
|
|
|
|
goos: linux
|
|
|
|
goarch: amd64
|
|
|
|
pkg: apiSpeedImprove
|
|
|
|
cpu: AMD Ryzen 5 7640U w/ Radeon 760M Graphics
|
|
|
|
BenchmarkEncodingJSON-12 140383 7381 ns/op
|
|
|
|
BenchmarkJSONIter-12 974605 1217 ns/op
|
|
|
|
PASS
|
|
|
|
ok apiSpeedImprove 3.216s
|
|
|
|
```
|
|
|
|
|
|
|
|
Read the article [here](https://4rkal.com/posts/goapi)
|