[GHC] #8972: Investigate adding fast compare-and-swap Int type/primops
GHC
ghc-devs at haskell.org
Thu Apr 10 13:08:30 UTC 2014
#8972: Investigate adding fast compare-and-swap Int type/primops
-------------------------------------+------------------------------------
Reporter: tibbe | Owner: tibbe
Type: feature request | Status: new
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: 8157, 7883
-------------------------------------+------------------------------------
Comment (by rrnewton):
Update: I confirmed that I get the exact same time for
"Data.Atomics.Counter' (atomic-primops) as I do for Johan (tibbe)'s
counter.c version of the benchmark here.
Johan and I talked about this and it seems like the obvious way to improve
performance on this is inline primops for the fetch-and-add (#7883). We
confirmed that the MutableByteArray# used by Data.Atomics.Counter is a
single contiguous heap object, so the only advantage of a dedicated
mutable reference type would be to save the word representing the length.
More, generally, I wonder if we can have a user facing interface that
makes mutable unboxed data more pleasant. Unboxed vectors are nice, but
there's nothing like an (IORef (# Int#, Int# #)), for example. Even
though with double-word CAS we could support some interesting data
types...
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8972#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list