Opened 4 years ago

Last modified 4 weeks ago

#4442 new feature request

Add unaligned version of indexWordArray#

Reported by: tibbe Owned by:
Priority: low Milestone: 7.6.2
Component: libraries (other) Version: 7.1
Keywords: Cc: duncan
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo)

indexWordArray# takes an offset in whole words, making it impossible to do unaligned reads on platforms that support such reads. This has performance implications for some programs e.g. implementations of MurmurHash.

I propose we add versions of indexWord*Array that take byte offsets. The user is responsible for only using those on platforms that support them and the implementation is free to crash if they're used elsewhere.

Change History (7)

comment:1 follow-up: Changed 4 years ago by simonmar

As per discussion on glasgow-haskell-users, this can be done with a combination of byteArrayContents#, plusAddr#, indexWordOffAddr#, and touch#. Does that work well enough for your purposes?

comment:2 in reply to: ↑ 1 Changed 4 years ago by tibbe

Replying to simonmar:

As per discussion on glasgow-haskell-users, this can be done with a combination of byteArrayContents#, plusAddr#, indexWordOffAddr#, and touch#. Does that work well enough for your purposes?

That only works if the array is pinned.

Simon suggested that we could replace the current primops with ones that take byte offsets and implement the current set of primops in terms of these, new primops.

comment:3 Changed 4 years ago by igloo

  • Description modified (diff)

comment:4 Changed 4 years ago by igloo

  • Milestone set to 7.2.1

comment:5 Changed 2 years ago by igloo

  • Milestone changed from 7.4.1 to 7.6.1
  • Priority changed from normal to low

comment:6 Changed 22 months ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:7 Changed 4 weeks ago by tibbe

  • Cc duncan added
  • Difficulty set to Unknown
Note: See TracTickets for help on using tickets.