
#10014: Data.Array.Base.elems needlessly calls bounds. -------------------------------------+------------------------------------- Reporter: ekmett | Owner: ekmett Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.4 Component: Core | Operating System: Unknown/Multiple Libraries | Type of failure: Runtime Keywords: | performance bug Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- {{{ elems arr = case bounds arr of (_l, _u) -> [unsafeAt arr i | i <- [0 .. numElements arr - 1]] }}} It never uses the result. I'd propose simplifying it to {{{ elems arr = [unsafeAt arr i | i <- [0 .. numElements arr - 1]] }}} It appears at some point someone optimized it to use the `unsafeAt`, but never removed the bounds check. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10014 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler