News for hackers. Stuff that matters.
Re:Ruby is too slow for programming competitions by darkgray on Sunday April 21, 2013 @04:48PM (#5586357)
Go 1.1 made int default to int64, so it may depend on how up-to-date your particular version is. God knows what the blog poster uses, though.
Re:Ruby is too slow for programming competitions by gnuvince on Sunday April 21, 2013 @04:52PM (#5586366)
I'm still on Go 1.0.2. However, I strongly doubt that having 1.1 yields the correct result in the amount of time that the article boasts; I rewrote the program in C (direct translation), and with both clang and gcc, I get timings of around 2m05s. It's hard to believe that for a CPU-bound task, a Go program would be 200x faster than a C program.
Re:Ruby is too slow for programming competitions by darkgray on Sunday April 21, 2013 @04:58PM (#5586388)
I'd agree it's dubious, but I was mostly commenting on the "correctness" of the code. It'd work on Go 1.1, so it's technically "correct". Sometimes. :)
Re:Ruby is too slow for programming competitions by gnuvince on Sunday April 21, 2013 @05:38PM (#5586517)
Fair enough.
Re:Ruby is too slow for programming competitions by voidlogic on Sunday April 21, 2013 @10:15PM (#5587398)
That is not quite right, before 1.1 int was 32-bit on all platforms and post 1.1 an int is 32-bit on 32-bit platforms and 64-bit on 64-bit platforms.

You are supposed to use int when you don't care about its size (int = native word size). If you are writing a program where it matters you should explicitly use int32 or int64.