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 bytes.IndexByte instead of bytes.Index for single byte lookup #999

Merged
merged 2 commits into from
Mar 20, 2021
Merged

Use bytes.IndexByte instead of bytes.Index for single byte lookup #999

merged 2 commits into from
Mar 20, 2021

Conversation

moredure
Copy link
Contributor

No description provided.

@moredure moredure changed the title Update uri.go Use bytes.IndexByte instead of bytes.Index for single byte lookup Mar 20, 2021
@erikdubbelboer erikdubbelboer merged commit a583006 into valyala:master Mar 20, 2021
@erikdubbelboer
Copy link
Collaborator

Thanks. I would expect the result to be the same as bytes.Index just calls bytes.IndexByte and the input is a constant. But it seems that as the compiler isn't smart enough to see that strAt never gets modified it isn't able to inline this. Even writing it as bytes.Index(host, []byte("@")) it isn't smart enough.

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