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

v.util: remove fast path in diff.compare_text #21458

Merged
merged 1 commit into from
May 8, 2024

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented May 7, 2024

The equality check of the strings that should be compared is done in most cases before the function is called in the V code base. It can be expected that it will be the same for external projects if they use the module.

Due to this, what was thought as fast-path can become a slow-down in cases where the compiler is not able to optimize the double check. Therefore it is removed and the function merely cares about returning the result of the comparison result.

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will only matter for long texts, that are nearly identical.

However simplifying code where possible, is always good.

Excellent work.

@spytheman spytheman merged commit b0c2841 into vlang:master May 8, 2024
69 checks passed
@ttytm ttytm deleted the utils/rm-ct-fastpath branch May 8, 2024 07:20
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.

None yet

2 participants