Re:Sum of 1 to 1000000000 in different programming languages
by jypepin on Monday August 05, 2013 @01:56PM
(#6161667)
According to the time it took to my macbook air to calculate it in ruby, it would be pretty interesting to have someone generate benchmarks for different languages :)
[ Parent
| on HN ]
Re:Sum of 1 to 1000000000 in different programming languages
by jdtw on Monday August 05, 2013 @03:18PM
(#6162259)
~500ms with optimized Common Lisp: http://stackoverflow.com/a/18065714/2423072
Re:Sum of 1 to 1000000000 in different programming languages
by surfearth on Monday August 05, 2013 @02:43PM
(#6161966)
sum(range(1, 100000001)) took ~3.25 seconds on my air under python3.
Re:Sum of 1 to 1000000000 in different programming languages
by gshubert17 on Monday August 05, 2013 @02:53PM
(#6162068)
Your number appears to be a factor of 10 smaller than the "one billion plus one" of the original.
I get similar times on my Mac; about 3.2 seconds for 108 and 31.4 seconds for 109. Both are about 5 times faster than Python 2.7 for me.