Opened 4 years ago

Last modified 3 months ago

#4442 new feature request

Add unaligned version of indexWordArray#

Reported by: tibbe Owned by: ekmett
Priority: low Milestone: 7.12.1
Component: Compiler Version: 7.1
Keywords: Cc: duncan
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

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 (11)

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 3 years ago by igloo

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

comment:6 Changed 3 years ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:7 Changed 10 months ago by tibbe

  • Cc duncan added
  • difficulty set to Unknown

comment:8 Changed 9 months ago by thoughtpolice

  • Milestone changed from 7.6.2 to 7.10.1

Moving to 7.10.1.

comment:9 Changed 6 months ago by thoughtpolice

  • Component changed from libraries (other) to Core Libraries
  • Owner set to ekmett

Moving over to new owning component 'Core Libraries'.

comment:10 Changed 4 months ago by thomie

  • Component changed from Core Libraries to Compiler
  • Type of failure changed from None/Unknown to Runtime performance bug

comment:11 Changed 3 months ago by thoughtpolice

  • Milestone changed from 7.10.1 to 7.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

Note: See TracTickets for help on using tickets.