3 ms·
All those times in the table seem... Slow... For example, BenchmarkPushFront-10 takes 9 ns... That should consist of one write to memory (to update the po
by londons_explore 5y ago
All those times in the table seem... Slow...
For example, BenchmarkPushFront-10 takes 9 ns... That should consist of one write to memory (to update the pointer in the object). With decent compiler optimizations and a modern out of order CPU, I think we ought to be expecting one of those per clock cycle, so we ought to be seeing performance of 0.5ns. Perhaps even faster if the compiler manages to vectorize stuff (although I'm not aware of any compiler that can vectorize memory allocations).
- makapuf 5y agoWell we don't know what is being pushed or what was the function call overhead. Edit: the -10 suffix can mean there is a 10x loop in the benchmark?
- Svip 5y agoThe -10 indicates the number of CPUs used.[0] But the `ns/op` should per iteration of the benchmarking loop. [0] https://blog.logrocket.com/benchmarking-golang-improve-function-performance/ https://blog.logrocket.com/benchmarking-golang-improve-funct...
- innocenat 5y agoSkimming the code it looks like one operation is 10 push front, not just 1.