Make Lisp 15x faster than Python or 4x faster than Java
blog.postabon.com
Make Lisp 15x faster than Python or 4x faster than Java
1–10 of 100 posts
Re: Make Lisp 15x faster than Python or 4x faster than Java
#2I thought you would only really be finding deals at distances small enough to just assume the earth is flat. Or at least, aren't those the only ones people would actually be interested in? If it's beyond my physical reach, I don't care how far it is. I'll get it shipped.
Or am I missing something?
Re: Make Lisp 15x faster than Python or 4x faster than Java
#3The most common way to compute your distance from a deal is to assume the earth is a perfect sphere I thought you would only really be finding deals at distances small enough to just assume the earth is flat. Or at least, aren't those the only ones people would actually be interested in? If it's beyond my physical reach, I don't care how far it is. I'll get it shipped. Or am I missing something?
Like I mentioned in the post, the distance function presented is a bit of a simplification I invented for pedagogical purposes (my goal was to examine languages, not geometry).
Re: Make Lisp 15x faster than Python or 4x faster than Java
#4Re: Make Lisp 15x faster than Python or 4x faster than Java
#5The most common way to compute your distance from a deal is to assume the earth is a perfect sphere I thought you would only really be finding deals at distances small enough to just assume the earth is flat. Or at least, aren't those the only ones people would actually be interested in? If it's beyond my physical reach, I don't care how far it is. I'll get it shipped. Or am I missing something?
You're absolutely right - in my experience the pythagorean theorem has less than ~50 meters difference from the Haversine formula for distances less than 20 miles or so. In the actual code I use a simple heuristic to decide when to use which calculation. Like I mentioned in the post, the distance function presented is a bit of a simplification I invented for pedagogical purposes (my goal was to examine languages, not…
I'd like to compare it to C.
Re: Make Lisp 15x faster than Python or 4x faster than Java
#6Earlier quoted context omitted.
You're absolutely right - in my experience the pythagorean theorem has less than ~50 meters difference from the Haversine formula for distances less than 20 miles or so. In the actual code I use a simple heuristic to decide when to use which calculation. Like I mentioned in the post, the distance function presented is a bit of a simplification I invented for pedagogical purposes (my goal was to examine languages, not…
Can you release the source data used for the benchmark? I'd like to compare it to C.
I just iterate through each latitude from -90 to 90 and each longitude from -180 to 180 in increments of 2.5 (for both the start and end). Check out the source code for any of the 5 examples (included in the post).
If you'd like, post the code up somewhere and I'll be happy to run it on the same machine and post the results along with the rest.
Re: Make Lisp 15x faster than Python or 4x faster than Java
#7Re: Make Lisp 15x faster than Python or 4x faster than Java
#8The most common way to compute your distance from a deal is to assume the earth is a perfect sphere I thought you would only really be finding deals at distances small enough to just assume the earth is flat. Or at least, aren't those the only ones people would actually be interested in? If it's beyond my physical reach, I don't care how far it is. I'll get it shipped. Or am I missing something?
You're absolutely right - in my experience the pythagorean theorem has less than ~50 meters difference from the Haversine formula for distances less than 20 miles or so. In the actual code I use a simple heuristic to decide when to use which calculation. Like I mentioned in the post, the distance function presented is a bit of a simplification I invented for pedagogical purposes (my goal was to examine languages, not…
I don't mean to discourage you or be cynical. I love the fact that you are writing interesting articles on the practicalities of using Lisp with actual data behind it. So, keep up the good work. I look forward to more posts.
Re: Make Lisp 15x faster than Python or 4x faster than Java
#9Are people still calling Lisp slow in 2010? That was somewhat true when most programming was done in C. Plenty of languages slower than Lisp have risen to popularity since then.
I think most people played with Scheme/Lisp in one class in college in the 90's and have been soured on it ever since.
Re: Make Lisp 15x faster than Python or 4x faster than Java
#10For example, take a look at the solutions to PRIME 1; the task is to generate a list of prime numbers: http://www.spoj.pl/ranks/PRIME1/
The top 20 C solutions all take less than 0.05 seconds. The top 20 Java solutions all take less than 0.5 second. Python has several solutions that took 0.55 seconds. But for Lisp, only one user was able to get it to less than 1 second, and then only barely.
There's not enough data to draw any real conclusions, but it does make me skeptical of claims that Lisp is near in speed to Java or C (any Lisp gurus who want to prove me wrong, feel free to code up a fast solution and submit it)