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

core/bytes: Tweak index_byte/last_index_byte #4101

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

Yawning
Copy link
Contributor

@Yawning Yawning commented Aug 18, 2024

  • Assume unaligned loads are cheap
  • Explicilty use 256-bit or 128-bit SIMD to avoid AVX512
  • Limit "vectorized" scanning to 128-bits if SIMD is emulated via SWAR
  • Add a few more benchmark cases

I also think last_index_byte would crash if s == nil (at least it looks suspicious). This is objectively worse on huge s with the character at the tail, if the starting address is not 16 or 32-byte aligned (depending on microarch), because the penalties will add up. I don't particularly think that case is worth optimizing for (and this has a code-path for < 4*SIMD_REG_SIZE), so it should be better on reasonable inputs.

core/bytes/bytes.odin Outdated Show resolved Hide resolved
core/bytes/bytes.odin Outdated Show resolved Hide resolved
core/bytes/bytes.odin Outdated Show resolved Hide resolved
core/bytes/bytes.odin Outdated Show resolved Hide resolved
core/bytes/bytes.odin Outdated Show resolved Hide resolved
- Assume unaligned loads are cheap
- Explicilty use 256-bit or 128-bit SIMD to avoid AVX512
- Limit "vectorized" scanning to 128-bits if SIMD is emulated via SWAR
- Add a few more benchmark cases
@Kelimion Kelimion merged commit 3fc1f6f into odin-lang:master Aug 19, 2024
6 checks passed
@Yawning Yawning deleted the feature/index-byte-tweaks branch August 20, 2024 03:05
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