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

Primitive to compare bytes #759

Merged
merged 6 commits into from
Mar 26, 2024

Conversation

doste
Copy link
Contributor

@doste doste commented Mar 25, 2024

Redo of #611

This pull request introduces a new primitive to compare bytes.

In the mentioned PR, two implementations were proposed, one using a loop in 'pure Pharo' and the other memcmp and thus relying on the C implementation.

We made a couple of benchmarks and we saw that the memcmp implementation:
- is 3x faster than doing it directly in Pharo when the compared bytes are few.
- is hundreds of times faster when comparing thousands of bytes.

The alternative word-by-word comparison implemented purely in slang is also better than the baseline but it is 10x slower than memcmp for large comparisons.

@guillep
Copy link
Member

guillep commented Mar 26, 2024

@doste Almost everything seems ok for this to land!

Tests show still two users of primitiveCompareBytes2. We should remove those tests before integration as the implementation does not exist anymore ^^.

imagen

@doste
Copy link
Contributor Author

doste commented Mar 26, 2024

primitiveCompareBytes2.

My bad. Now it's been removed :)

@guillep guillep merged commit 92bf0d3 into pharo-project:pharo-10 Mar 26, 2024
1 of 2 checks passed
@guillep guillep mentioned this pull request Apr 8, 2024
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