A few comments: For such microbenchmarks you need to check the assembler for optimizations. The C code probably removed the complete loop.
The Go version and machine architecture is relevant. There were significant changes recently, particular with the introduction of SSA (static single assignment) for amd64. Usally for _, x := range <slice/array> is much faster than direct access. The difference between array and slice is probably that the slice access must read the pointer to the backing array before the actual value can be accessed. This step is not required for arrays. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.