Thank you all, I will apply your suggestions to my function.

Thank you for making the process of learning Haskell much easier!

Arnoldo

On Fri, Mar 19, 2010 at 4:21 PM, Achim Schneider <barsoap@web.de> wrote:
Arnoldo Muller <arnoldomuller@gmail.com> wrote:

> Right now, the bottleneck of my program is in binarySearch', the
> function must be called a few billion times.
>
> Do you have any ideas on how to improve the performance of this
> function?
>
The fastest way to do a binary search is to reify it into code using
TH, in Van Emde Boas layout if it's a big enough search (so that you
get less cache misses)

This might of course get tricky if your tree isn't compile-time static,
but if you're really doing gazillions of lookups, occasionally
compiling+dynamically linking code might well be worth it.

--
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe