Live data from Hacker News

Make Lisp 15x faster than Python or 4x faster than Java

blog.postabon.com

1–10 of 100 posts

Re: Make Lisp 15x faster than Python or 4x faster than Java

#2
The 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?

Re: Make Lisp 15x faster than Python or 4x faster than Java

#3
post #2

The 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 geometry).

Re: Make Lisp 15x faster than Python or 4x faster than Java

#5
post #3
post #2

The 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…

Can you release the source data used for the benchmark?

I'd like to compare it to C.

Re: Make Lisp 15x faster than Python or 4x faster than Java

#6
post #5
post #3

Earlier 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.

There is no source data.

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

#8
post #3
post #2

The 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…

Fair enough. But then that raises a more important issue: you are showing Lisp is faster than more popular languages in a way that probably doesn't matter much. When I read the title, I was hoping this isn't some benchmarking or academic exercise, which does not have relevance for real applications. So I was delighted to read that this is something you use in your webapp, only to be disappointed again now.

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

#9
post #7

Are 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.

Yeah, I find it an odd criticism too - but you'd be surprised how many people still bring it up.

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

#10
One interesting source of data is www.spoj.pl, since they keep records of the runtime of submissions to their site.

For 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)

Post reply on HN