Skip to content

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.

{
/// 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.

{
/// 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.

2 participants