[vector] #74: expose the bytearray in primitive vectors

vector vector at projects.haskell.org
Fri Jan 13 13:26:21 GMT 2012


#74: expose the bytearray in primitive vectors
------------------------+---------------------------------------------------
Reporter:  choener      |       Owner:     
    Type:  enhancement  |      Status:  new
Priority:  minor        |   Milestone:     
 Version:               |    Keywords:     
------------------------+---------------------------------------------------
 This is based on our discussion regarding vector / primitive performance.
 Right now, in some tight loop, I see a 20% performance dropoff due to the
 offset being always calculated. Hence I use bytearrays directly. They are,
 on the other hand terribly inconvinient in some cases.

 I propose a method
 {{{
 expose :: Vector -> ByteArray
 }}}
 that exposes the underlying array directly for faster indexing operations.
 In addition / alternatively I'd like an operation
 {{{
 unsafeBaseIndex :: Vector -> elm
 }}}
 that works like unsafeIndex but never incorporates the offset.

 The reasoning is that there are cases where we always know the offset to
 be zero and no slicing would ever happen.

 Benchmarks on vector / primitive will follow.

-- 
Ticket URL: <http://trac.haskell.org/vector/ticket/74>
vector <http://trac.haskell.org/vector>
Package vector


More information about the vector mailing list