logo       

[ ghc-Bugs-753152 ] missed CSE opportunity: msg#00062

lang.haskell.glasgow.bugs

Subject: [ ghc-Bugs-753152 ] missed CSE opportunity

Bugs item #753152, was opened at 2003-06-12 09:29
Message generated for change (Settings changed) made by simonmar
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=753152&group_id=8032

Category: Compiler
Group: 5.04.2
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
>Summary: missed CSE opportunity

Initial Comment:
Don't know if this is a bug, but it was at least
_surprising_ to find that

playerMostOccur [a] = a
playerMostOccur (x:xs)| numOccur x (x:xs)
>
numOccur
(playerMostOccur xs) xs
= x
| otherwise =
playerMostOccur xs

was exponentially slower when compiled with ghc-5.04.2
-O than:

playerMostOccur [a] = a
playerMostOccur (x:xs)| numOccur x (x:xs)
>
numOccur pmo xs
= x
| otherwise = pmo
where pmo =
playerMostOccur xs

Although the student responsible for the code couldn't
spot the
obvious optimisation, I was expecting that GHC's
optimiser would. :)
If it's not a bug, could you explain it to me?

-Greg(gregm.at.cs.uwa.edu.au)

----------------------------------------------------------------------

Comment By: Simon Marlow (simonmar)
Date: 2004-12-17 09:46

Message:
Logged In: YES
user_id=48280

Looks like a case where GHC's CSE isn't spotting the common
subexpression. The CSE in GHC is pretty cheap & cheerful,
there are plenty of ways it could be improved, or even
replaced by a completely new one.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=753152&group_id=8032


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise