Make Lisp 15x faster than Python or 4x faster than Java
81–90 of 100 posts
Re: Make Lisp 15x faster than Python or 4x faster than Java
#82Re: Make Lisp 15x faster than Python or 4x faster than Java
#83Re: Make Lisp 15x faster than Python or 4x faster than Java
#84And of course, Haskell can be faster than all of these.
Not always: http://shootout.alioth.debian.org/u32/benchmark.php?test=all...
Re: Make Lisp 15x faster than Python or 4x faster than Java
#85I ran the Python script through Shedskin, a partial Python implementation that compiles Python to machine code via an intermediate layer of C++. I did not have to declare any types for any variables, or add declarations for speed/safety; Shedskin automatically determined the types. The finished program went down in runtime from 533.7s on my machine, to 24.42 seconds. If we adjust for machine speed (since the author's…
Re: Make Lisp 15x faster than Python or 4x faster than Java
#86Re: Make Lisp 15x faster than Python or 4x faster than Java
#87Earlier quoted context omitted.
Java and Python are actually doing all of the work to compute their trigonometric functions Not true in the case of CPython. It uses the underlying C implementation. See line 270 onwards. http://www.google.com/codesearch/p?hl=en#2T6lfGELm_A/trunk/M...
Interesting.. well, I'd think the trig functions would be by far the most expensive part of that program. Is Python really that much slower for control structures? That's literally the only other computation there.
Re: Make Lisp 15x faster than Python or 4x faster than Java
#88Or you could, you know, use C++: http://stevehanov.ca/blog/index.php?id=95
Re: Make Lisp 15x faster than Python or 4x faster than Java
#89And of course, Haskell can be faster than all of these.
I coded it in haskell, and it is faster, if it's a correct translation. Without parallelizing, it clocks at 1.8 seconds, compiled with $ ghc --make. If anyone plans to compile this you'll need to $ cabal install geodetic, before $ ghc --make filename.hs
1.8 Seconds seems a little too fast though...
Re: Make Lisp 15x faster than Python or 4x faster than Java
#90Isn't it a much better idea to pick a distance comparison algorithm that's not so staggeringly slow to begin with? Why not convert (i.e. pre-compute) the lat/lons to 3-vectors (origin center of the earth) and then compare distances by pythagoras, no fuss, muss or trig and you can even skip the square root. If you need to display an actual accurate distance you can do the (significantly smaller amount of) trig to get…