#5925: Add inline version of newArray#
------------------------------+---------------------------------------------
Reporter: tibbe | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 7.4.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
It'd would be nice to have an inline version of `newArray#` so that
allocation of small arrays is cheaper (e.g. the heap check could be paired
up with other heap checks.)
I see two possible designs:
1. Add a branch to `newArray#` that checks the requested size and either
allocates inline or out-of-line.
2. Add a new primop e.g. `newSmallArray#` that always allocates inline.
I would lean towards (2). While (1) is equal to (2) in the case when the
size is statically known (assuming that GHC can discover that fact through
enough inlining at the Cmm level), there are cases where the programmer
knows that the size is small, without knowing the exact size. This happens
e.g. when you use arrays to represent small variable-length tuples (e.g.
in the `unordered-containers` package.)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5925>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs