[GHC] #11143: Feature request: Add index/read/write primops with byte offset for ByteArray#

GHC ghc-devs at haskell.org
Thu Feb 22 18:09:43 UTC 2018


#11143: Feature request: Add index/read/write primops with byte offset for
ByteArray#
-------------------------------------+-------------------------------------
        Reporter:  vagarenko         |                Owner:  sjakobi
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:  newcomers
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4433
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by sjakobi):

 Replying to [comment:9 vagarenko]:
 > Replying to [comment:8 sjakobi]:
 > > * They relieve the user from doing the byte offset computation.
 > Then what does that `Int# {-byte offset-}` parameter mean?

 What I meant is that the user doesn't need to compute the total offset.
 While a user may use the API you proposed like
 {{{#!hs
 indexByteInt16Array# ba (byte_offset + type_offset * int16_size)

 }}}
 the other API offers
 {{{#!hs
 indexByteInt16Array# ba byte_offset type_offset

 }}}
 which IMO is simply more concise and convenient.

 I hope this answers your question.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11143#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list