Skip to content

Conversation

@polytypic
Copy link
Collaborator

@polytypic polytypic commented May 25, 2024

This PR adds an Atomic_array module that gives a limited functionality equivalent of 'a Atomic.t array using internally only an 'a array based on the caml_atomic_cas_field function that already exists in the OCaml 5.0.0 - 5.2.0 runtime.

The benefit of this is that only 1 word, instead of 3 words, is used per array element (i.e. a significant drop in memory use and allocations) and an indirection is avoided (i.e. less pointer chasing). This translates to, depending on the case, to significant performance improvements in the implementation of array based lock-free data structures (up to 40% improvement has been seen in some cases).

@polytypic polytypic force-pushed the add-atomic_array branch 5 times, most recently from f90522f to 114d87d Compare May 27, 2024 13:13
@polytypic polytypic marked this pull request as ready for review May 27, 2024 13:15
@polytypic polytypic force-pushed the add-atomic_array branch 3 times, most recently from 666a34f to 1c46c92 Compare May 27, 2024 15:36
@polytypic polytypic merged commit 48b6b92 into main May 27, 2024
@polytypic polytypic deleted the add-atomic_array branch May 27, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants