4 ms·
https://github.com/wundergraph/graphql-go-tools/blob/dcd50bd528aba3eba9e553203150724dbe193fdf/v2/pkg/astjson/astjson_test.go#L448-L477 https://github.com/wunder
by kiitos 3y ago
https://github.com/wundergraph/graphql-go-tools/blob/dcd50bd528aba3eba9e553203150724dbe193fdf/v2/pkg/astjson/astjson_test.go#L448-L477 https://github.com/wundergraph/graphql-go-tools/blob/dcd50bd...
Each iteration of this benchmark measures the aggregate performance of
- 1x ParseObject
- 3x AppendObject
- 3x MergeNodesWithPath
- 1x PrintNode
- 1x bytes.Equal comparison of two byte slices
So the benchmark isn't really measuring MergeNodesWithPath, it's measuring a much larger composite operation, which includes (multiple) calls to MergeNodesWithPath but also all of the above listed calls as well.
If you want to measure MergeNodesWithPath, you would need to have each iteration of the loop do a single MergeNodesWithPath call, on the same JSON method receiver, and with the same input parameters.
edit: similar issues exist in many/most of the other benchmark functions as well