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

runtime: use tophash == emptyRest to decrease search times in mapaccess1_faststr and mapaccess2_faststr #68912

Open
yuanjize opened this issue Aug 16, 2024 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Performance
Milestone

Comments

@yuanjize
Copy link

Proposal Details

In function mapaccess2_faststr and mapaccess2_faststr , I think we can add follow code in dohash block to decrease the search in bucket & over flow buckets.

   if b.tophash[i] == emptyRest {
       return unsafe.Pointer(&zeroVal[0])
   }

Position:

k := (*stringStruct)(kptr)

I am pleasure to change it if you think it is good.

@gopherbot gopherbot added this to the Proposal milestone Aug 16, 2024
@yuanjize
Copy link
Author

@mknyszek

@randall77
Copy link
Contributor

Seems reasonable. We're switching over to Swiss tables very soon (#54766), so it might not be worth doing as this code is about to be obsolete.
It will need a benchmark.

@randall77 randall77 modified the milestones: Proposal, Go1.24 Aug 16, 2024
@mknyszek mknyszek changed the title proposal: import/path: proposal map: in mapaccess1_faststr amd mapaccess2_faststr we can use tophash == emptyRest to decrease search times runtime: use tophash == emptyRest to decrease search times in mapaccess1_faststr and mapaccess2_faststr Aug 16, 2024
@mknyszek mknyszek added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. compiler/runtime Issues related to the Go compiler and/or runtime. labels Aug 16, 2024
@mknyszek
Copy link
Contributor

CC @golang/runtime

@mknyszek mknyszek modified the milestones: Go1.24, Backlog Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Performance
Projects
Development

No branches or pull requests

4 participants