Random thought: I'm sure people who actually know about this stuff will be able to tell me why it won't work, or, alternatively, cases where it's already been done.
Recall the problem with the
naive Haskell mean programmean xs = sum xs / length xs
which when asked to calculate the mean of [1 .. 1e9] allocates 8GB of RAM and brings the computer to a
(
Read more... )
Comments 12
But, there were talks about forcing thunks on garbage collector stage, it should improve memory behavior.
Reply
Sure, but there are only finitely many programmers, each of whom have a finite amount of time in which to perform optimisations :-) And Yegge's point (which is borne out in practice) is that VMs have access to accurate runtime data for the program as it is actually being used, and so are in a position to make better decisions about optimisation than the programmer was at compile-time.
Reply
And log N is a constant already around N=106. ;)
Reply
Instead of trying to do clever things we don't know how to do, would it be possible to do an automatic transform to turn the naive version into the parallel version?
Reply
{-# RULES "foldl fusion"
forall f g h z1 z2 xs . f (foldl g z1 xs) (foldl h z2 xs) =
(uncurry f) (foldl (\(a,b) x -> (g a x, g b x)) (z1, z2) xs)
#-} isn't allowed, because it's the application of a variable - rules are indexed on the function that's applied at the head. So, in principle yes, but not with GHC as it currently stands.
And, while looking for that, I discovered that someone else had already had the idea of this post - or rather, someone else had the first half, and I chipped in with the second half two weeks ago, and then forgot about it :-(
Reply
I still don't think that making the GC throw away data is the right way to approach this problem, when the essence of it is evaluating inherently parallel functions in serial on a very long list.
It's a little annoying that you can't do it with the existing GHC setup, but I'm still new to haskell myself - I imagine though it might be possible to do the same with more ugly rules though.
Reply
Reply
Reply
Reply
Reply
Are you into doing Seo work or perhaps spamming weblogs? Well i can offer you a very cheap VPS with the following software installed (You use my license!)
SENuke pro edition (Normally costs $127 monthly)
Scrapebox ($97)
The Best Spinner ($77 yearly)
Watch my quick YouTube video! http://www.youtube.com/watch?v=paExU60Hy8A
You can aquire usage of all three of those ultra powerful SEO tools for a small charge of $50 monthly.
The VPS server itself is extremely powerful and fast, you simply will not find this sort of offer anywhere else for this sort of price!
Visit http://hellomotow.net For more information
Reply
Leave a comment