Changing just the mod operation to int32 made the whole program run about 2.5 times faster for me. Wow! I had no idea that there would be that much difference.
John John Souvestre - New Orleans LA -----Original Message----- From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On Behalf Of Konstantin Shaposhnikov Sent: 2017 February 26, Sun 00:42 To: golang-nuts Subject: [go-nuts] Re: [Newbie] Why this code is so slow? int type in Go is 64 bit on 64 bit system . Most likely you are using 32 bit integers in other languages (e.g. int in Java). 64 bit division is slower than 32 bit. Try changing your Go program to use int32 instead and see if it becomes faster. -- 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. -- 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.