Skip to content

Optimized strcmp and strncmp. Also added memrchr#598

Merged
mateoconlechuga merged 1 commit into
masterfrom
pr/strcmp_opt
May 6, 2025
Merged

Optimized strcmp and strncmp. Also added memrchr#598
mateoconlechuga merged 1 commit into
masterfrom
pr/strcmp_opt

Conversation

@ZERICO2005
Copy link
Copy Markdown
Contributor

Optimized strcmp and strncmp. Also added memrchr

strncmp has a linear speedup compared to Ti's routine (less clock cycles per character compared), making it much faster

strcmp has a constant speedup compared to Ti's routine (same clock cycles per character compared, but takes less clock cycles in total), which may be worth it when multiple short string comparisons need to be performed, such as when parsing text/scripts.

@mateoconlechuga
Copy link
Copy Markdown
Collaborator

Please fix the tests :)

@mateoconlechuga mateoconlechuga merged commit 4af9686 into master May 6, 2025
9 checks passed
@mateoconlechuga mateoconlechuga deleted the pr/strcmp_opt branch May 6, 2025 19:38
@ZERICO2005 ZERICO2005 added the libc label Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants