www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Take Python, add ";" and "auto", get 140x speed up ;)

reply "thedeemon" <dlang thedeemon.com> writes:
Just a bit of evangelism.

Original post of drawing Ulam's spiral of primes:
http://users.softlab.ece.ntua.gr/~ttsiod/primes.html

the Python code:
https://github.com/ttsiodras/PrimeSpirals/blob/master/primeSpirals.py

Direct translation to D:
https://gist.github.com/thedeemon/8295146

Result is somewhat shorter and two orders of magnitude faster 
even with the same very very slow and unoptimal algorithm. And, 
it seems, 2x faster than PyPy and Shedskin that do pretty much 
the same thing.

http://www.reddit.com/r/programming/comments/1ujoyk/the_ulam_spiral_python_50x_speedup_with_pypy/
Jan 06 2014
parent "Brian Schott" <briancschott gmail.com> writes:
But if it's in D how will your type mismatches leap out of the 
shadows at you at runtime?
Jan 06 2014