Opened 7 years ago

Last modified 16 months ago

#4442 new feature request

Add unaligned version of indexWordArray#

Reported by: tibbe Owned by:
Priority: low Milestone:
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 Rev(s):
Wiki Page:

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

comment:1 Changed 7 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 7 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 7 years ago by igloo

Description: modified (diff)

comment:4 Changed 7 years ago by igloo

Milestone: 7.2.1

comment:5 Changed 5 years ago by igloo

Milestone: 7.4.17.6.1
Priority: normallow

comment:6 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:7 Changed 3 years ago by tibbe

Cc: duncan added
difficulty: Unknown

comment:8 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:9 Changed 3 years ago by thoughtpolice

Component: libraries (other)Core Libraries
Owner: set to ekmett

Moving over to new owning component 'Core Libraries'.

comment:10 Changed 2 years ago by thomie

Component: Core LibrariesCompiler
Type of failure: None/UnknownRuntime performance bug

comment:11 Changed 2 years ago by thoughtpolice

Milestone: 7.10.17.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.

comment:12 Changed 21 months ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:13 Changed 21 months ago by thomie

Owner: ekmett deleted

comment:14 Changed 16 months ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.