[stdlib] Use memcmp to dispatch to optimized implementation in StringSlice#5624
[stdlib] Use memcmp to dispatch to optimized implementation in StringSlice#5624YichengDWu wants to merge 1 commit into
memcmp to dispatch to optimized implementation in StringSlice#5624Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the StringSlice comparison logic by replacing a direct call to the internal _memcmp_impl_unconstrained function with the public memcmp API, enabling automatic dispatch to optimized memory comparison implementations.
- Removed direct import of internal
_memcmp_impl_unconstrainedfunction - Updated
__lt__method to use publicmemcmpAPI instead
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
!sync |
|
✅🟣 This contribution has been merged 🟣✅ Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the main branch during the next Mojo nightly release, typically within the next 24-48 hours. We use Copybara to merge external contributions, click here to learn more. |
|
Landed in 3fe4f86! Thank you for your contribution 🎉 |
This PR updates the comparison logic in
StringSliceto use the publicmemcmpAPI instead of the internal_memcmp_impl_unconstrained.Previously,
StringSlicewas directly calling_memcmp_impl_unconstrained. By switching to the standardmemcmp, we allow the call to be properly dispatched to the optimized implementation (_memcmp_impl_opt_unconstrained).This ensures that string slice comparisons leverage the best available memory comparison implementation provided by the standard library.