Skip to content

Conversation

@Earlopain
Copy link
Collaborator

This is more concise and ruby does a better job performance-wise.

This used to be bsearch_index already but 6d8358c changed it. #1733 (comment) said:

Yeah the edge case was that the value matched an element exactly

But surely there would be a test to show this behaviour?

Gets called as part of pretty-printing nodes.
Further reduces the time for SnapshotsTest by ~16% for me.

This is more concise and ruby does a better job performance-wise.

This used to be `bsearch_index` already but ruby@6d8358c changed it.
ruby#1733 (comment) said:
> Yeah the edge case was that the value matched an element exactly

But surely there would be a test to show this behaviour?

Gets called as part of pretty-printing nodes.
Further reduces the time for `SnapshotsTest` by ~16% for me.
@kddnewton
Copy link
Collaborator

If I recall correctly, it was getting the wrong line number when the bounds of the node hit the newline exactly. I think maybe heredocs were the issue? I'm surprised to see none of the snapshots change though. I'm going to optimistically merge this and hope things are fine assuming this is good.

@kddnewton kddnewton merged commit c2dfb8e into ruby:main Nov 29, 2025
64 checks passed
@Earlopain Earlopain deleted the optimize-find-line branch December 3, 2025 07:36
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.

2 participants