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

Optimize IndexOfAny(byte,...) ICache for short lengths #40883

Closed

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Aug 15, 2020

3.4.2.6 Optimization for Decoded ICache

...

Two Branches in a Decoded ICache Way

The Decoded ICache can hold up to two branches in a way. Dense branches in a 32 byte aligned chunk,
or their ordering with other instructions may prohibit all the micro-ops of the instructions in the chunk
from entering the Decoded ICache.
This does not happen often. When it does happen, you can space the
code with NOP instructions where appropriate. Make sure that these NOP instructions are not part of hot
code.

Example of reducing ~3 branches per 32 bytes to 1 per 32 bytes

image

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@benaadams benaadams force-pushed the optimize-indexofany-shortlengths branch from e862389 to 21d4bce Compare August 15, 2020 16:55
@benaadams benaadams marked this pull request as ready for review August 15, 2020 21:04
@benaadams benaadams force-pushed the optimize-indexofany-shortlengths branch from 1d784da to 0f362ef Compare August 16, 2020 00:53
@benaadams
Copy link
Member Author

meh

@benaadams benaadams closed this Aug 16, 2020
@benaadams benaadams deleted the optimize-indexofany-shortlengths branch August 16, 2020 02:50
@benaadams
Copy link
Member Author

Benchmarks don't agree

@gfoidl
Copy link
Member

gfoidl commented Aug 16, 2020

Benchmarks don't agree

But a very nice idea 👍
Something I have to remember...

@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants