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

Use #![no_std] by default #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Use #![no_std] by default #12

wants to merge 2 commits into from

Conversation

vtta
Copy link

@vtta vtta commented Oct 1, 2023

#![no_std] makes this crate usable for kernel development.

@robclu
Copy link
Owner

robclu commented Oct 2, 2023

Hi,

Thanks for this, I'm generally in favour of these changes, and mostly looks good.

I'm slightly unsure of the change to the default hasher, however. I would like to make sure that the default hasher is good enough for most use cases, and compares well to the default hasher in std, since most users will expect at least that level of performance.

It would be good to add a test/benchmark over use cases with representative data, that will test the number of collisions of the different hashers (including the default in std), and then choose based on that.

Something like what was done here.

From that comment (the dataset sizes are too small, especially for numbers we would want to measure collisions up to at least u32::MAX and ideally to u64::MAX), it seems that FNV-1a or Murmur3 would be better choices for the default hasher, but adding a test/benchmark would could be extended with additional data would be great, so that it's clear why the default hasher was chosen.

Copy link
Owner

@robclu robclu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes, otherwise looks good.

@@ -129,7 +129,8 @@ where
A: Allocator,
{
/// The default initial size of the map.
const INITIAL_SIZE: usize = 8;
/// Make sure it's a multiple of CELLS_IN_USE, so that no floats are needed during resizing
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are -> are not

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, meant: "no floats are needed" -> "floats are not needed". It's a little more clear.

@@ -161,7 +163,8 @@ where
A: Allocator,
{
/// The default initial size of the map.
const INITIAL_SIZE: usize = 8;
/// Make sure it's a multiple of CELLS_IN_USE, so that no floats are needed during resizing
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are -> are not

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, meant: "no floats are needed" -> "floats are not needed". It's a little more clear.

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.

None yet

2 participants