Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ara Adkins
Glasgow Haskell Compiler
Commits
15532cb1
Commit
15532cb1
authored
May 27, 2004
by
simonpj
Browse files
[project @ 2004-05-27 11:32:03 by simonpj]
Inline the default method for newArray; big perf boost; comments with the pragma
parent
9eef5c0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/base/Data/Array/Base.hs
View file @
15532cb1
...
...
@@ -968,6 +968,10 @@ class (HasBounds a, Monad m) => MArray a e m where
unsafeRead
::
Ix
i
=>
a
i
e
->
Int
->
m
e
unsafeWrite
::
Ix
i
=>
a
i
e
->
Int
->
e
->
m
()
{-# INLINE newArray #-}
-- The INLINE is crucial, because until we know at least which monad
-- we are in, the code below allocates like crazy. So inline it,
-- in the hope that the context will know the monad.
newArray
(
l
,
u
)
init
=
do
marr
<-
newArray_
(
l
,
u
)
sequence_
[
unsafeWrite
marr
i
init
|
i
<-
[
0
..
rangeSize
(
l
,
u
)
-
1
]]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment