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

refactor: slightly faster queue adaptation #290

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

andywiecko
Copy link
Owner

Refactor and optimize queue adaptation in refinement step (likely negligible impact on performance).

Before

        lea               eax, [rdx + 2*rdx]
        cmp               eax, ecx
        sete              r8b
        lea               eax, [rdx + 2*rdx + 1]
        cmp               eax, ecx
        sete              al
        lea               edx, [rdx + 2*rdx + 2]
        cmp               edx, ecx
        sete              cl
        or                cl, al
        or                cl, r8b
        movzx             eax, cl

After

        movsxd            rax, ecx
        imul              rcx, rax, 1431655766
        mov               rax, rcx
        shr               rax, 63
        shr               rcx, 32
        add               ecx, eax
        xor               eax, eax
        cmp               ecx, edx
        sete              al

Refactor and optimize queue adaptation in refinement step (likely negligible impact on performance).

### Before

```asm
        lea               eax, [rdx + 2*rdx]
        cmp               eax, ecx
        sete              r8b
        lea               eax, [rdx + 2*rdx + 1]
        cmp               eax, ecx
        sete              al
        lea               edx, [rdx + 2*rdx + 2]
        cmp               edx, ecx
        sete              cl
        or                cl, al
        or                cl, r8b
        movzx             eax, cl
```

### After

```asm
        movsxd            rax, ecx
        imul              rcx, rax, 1431655766
        mov               rax, rcx
        shr               rax, 63
        shr               rcx, 32
        add               ecx, eax
        xor               eax, eax
        cmp               ecx, edx
        sete              al
```
@andywiecko andywiecko merged commit 4f68f7e into main Nov 14, 2024
6 checks passed
@andywiecko andywiecko deleted the refactor/slightly-faster-queue-adaptation branch November 14, 2024 16:30
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.

1 participant