Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract Link type for unsafe rotations #26

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mlodato517
Copy link
Owner

This Commit

Extracts a Link type to implement on rotations so root and non-root nodes can rotate purely through pointer swapping.

Why?

This method of rotation is simpler to understand and maintain compared to the previous mem::swap approach. Also, for nodes with large keys/values, moving pointers will be faster than mem::swapping node fields.

Benchmarks

With the change of benchmarks to have nodes with [i32; 1024], it seems to make an improvement but it didn't help for nodes with i32 values. We might want a constant time check to decide between the two based on the types of K and V.

## This Commit

Extracts a `Link` type to implement on rotations so root and non-root
nodes can rotate purely through pointer swapping.

## Why?

This method of rotation is simpler to understand and maintain compared
to the previous `mem::swap` approach. Also, for nodes with large
keys/values, moving pointers will be faster than `mem::swap`ping node
fields.

## Benchmarks

With the change of benchmarks to have nodes with `[i32; 1024]`, it seems
to make an improvement but it didn't help for nodes with `i32` values.
We might want a constant time check to decide between the two based on
the types of `K` and `V`.
@mlodato517 mlodato517 self-assigned this Mar 16, 2023
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.

1 participant