Ticket #149 (new bug: None)
missed CSE opportunity
| Reported by: | nobody | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | _|_ |
| Component: | Compiler | Version: | 5.04.2 |
| Keywords: | optimisations | Cc: | michal.terepeta@…, hackage.haskell.org@… |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Runtime performance bug | Difficulty: | Moderate (less than a day) |
| Test Case: | T149 | Blocked By: | |
| Blocking: | Related Tickets: |
Description (last modified by simonmar) (diff)
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)
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

