[GHC] #8885: Add inline versions of clone array primops
GHC
ghc-devs at haskell.org
Sat Mar 15 21:49:18 UTC 2014
#8885: Add inline versions of clone array primops
-------------------------------------+------------------------------------
Reporter: tibbe | Owner: simonmar
Type: feature request | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 7.9
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by tibbe):
My intuition to use a pointer based copy loop instead of an index based
loop seems to have been wrong. Changing the loop from:
{{{
dst_p = dst + SIZEOF_StgMutArrPtrs;
src_p = src + SIZEOF_StgMutArrPtrs + WDS(offset);
while:
if (n != 0) {
n = n - 1;
W_[dst_p] = W_[src_p];
dst_p = dst_p + WDS(1);
src_p = src_p + WDS(1);
goto while;
}
}}}
to
{{{
dst_p = dst + SIZEOF_StgMutArrPtrs;
src_p = src + SIZEOF_StgMutArrPtrs + WDS(offset);
i = 0;
while:
if (i < n) {
W_[dst_p + i] = W_[src_p + i];
i = i + 1;
goto while;
}
}}}
improves performance on my benchmark (clone array of 17 elements) by 14%.
Attached patch with this improvement.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8885#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list