On Thursday, March 25, 2021 at 12:31:25 PM UTC-7 Didier wrote:
> I believe this is simply due to the 64 bits integer division. > > 1. Contrary to Java or most C implementations int is 64 bits with Go on > AMD64, and not 32 bits. Integer division on 64 bits is more expensive than > for 32 bits. > 2. When array_length is known at compile time, the compiler can replace > the integer division done for % with cheaper operations. > And now compile-time-constant program with explicit int32 and run-time-value program with explicit int64. In summary — compile-time-constant program int 3m3.225s int32 2m43.404s int64 3m3.240s run-time-value program int 18m20.737s int32 6m57.880s int64 18m21.020s Hmmm what explains the difference for the compile-time-constant program between int and explicit int32 ? -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7c863b31-a386-4cd7-8c66-e353946f4ce0n%40googlegroups.com.