[Haskell-cafe] the case of the 100-fold program speedup

Simon Peyton-Jones simonpj at microsoft.com
Thu Nov 16 03:07:35 EST 2006

Don't knock it!  Using a functional language helped you to think about the problem in a new way, and throw together a prototype that worked in a short enough time that you actually did it.  A merit of fp is, I think, that you can explore the algorithm design space much more quickly -- and algorithms are the dominant factor in the performance equation.


| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Seth
| Gordon
| Sent: 15 November 2006 20:49
| To: haskell-cafe at haskell.org
| Subject: Re: [Haskell-cafe] the case of the 100-fold program speedup
| As Lily Tomlin would say, neVERmind.
| Simon P-J asked me, in email, whether the deforestation was the thing
| that actually made the program faster or whether it was just the thing
| that made me think about how to solve the problem.  I realized that my
| fast program had *another* difference from the earlier, slower program:
| it was based on an algorithm that was specifically designed to clip
| polygons to rectangles, whereas OGR just had a function to compute the
| intersection between two arbitrary polygons.
| So I threw together a version that accumulated all the vertices of the
| clipped polygon in a list and then iterated through the list to compute
| the centroid--i.e., preserving everything from my fast program except
| the deforestation--and it ran at almost exactly the same speed as the
| deforested program.  (Actually, it ran 2% faster, but that could be just
| random variation from things like the load on the database server.)
| "The tragedy of science: a beautiful theory slain by an ugly fact."
| "T. H. Huxley said it first."
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list