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

Remove the need for unwrap when using ProbeSeq #208

Merged
merged 4 commits into from
Oct 15, 2020
Merged

Conversation

Marwes
Copy link
Contributor

@Marwes Marwes commented Oct 13, 2020

Changes the order of operation here a bit so that the code only moves to the next position if it is actually necessary which could be faster, or at least makes for less work for LLVM.

#[inline]
fn next(&mut self) -> Option<usize> {
impl ProbeSeq {
fn move_next(&mut self, bucket_mask: usize) {
Copy link
Member

Choose a reason for hiding this comment

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

Why did you change this to pass the bucket mask as an argument?

Copy link
Member

Choose a reason for hiding this comment

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

Also this method needs #[inline].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ProbeSeq never changes it so it duplicates data already found in the table. Figured it was only there since Iterator::next couldn't take an argument.

src/raw/mod.rs Outdated
for pos in self.probe_seq(hash) {
let mut probe_seq = self.probe_seq(hash);
loop {
let pos = probe_seq.pos;
Copy link
Member

Choose a reason for hiding this comment

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

Just use probe_seq.pos directly in the code below.

@Amanieu
Copy link
Member

Amanieu commented Oct 15, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Oct 15, 2020

📌 Commit cbcd654 has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Oct 15, 2020

⌛ Testing commit cbcd654 with merge 8bee6b8...

@bors
Copy link
Contributor

bors commented Oct 15, 2020

☀️ Test successful - checks-travis
Approved by: Amanieu
Pushing 8bee6b8 to master...

@bors bors merged commit 8bee6b8 into rust-lang:master Oct 15, 2020
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.

3 participants