Skip to content

Commit

Permalink
Merge pull request #1454 from kk-ds-000/perf/dont-generate-unneeded-s…
Browse files Browse the repository at this point in the history
…tring

Avoid unnecessary string allocation when calculating length
  • Loading branch information
lsegal authored Sep 3, 2022
2 parents 4fe39b6 + 7e7b413 commit 134be75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/yard/registry_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def lookup_path_inherited(namespace, path, type)

path.scan(split_on_separators_match).each do |part, sep|
cur_obj = nil
pos += "#{part}#{sep}".length
pos += part.length
pos += sep.length
parsed_end = pos == path.length

if !last_obj || (!parsed_end && !last_obj.is_a?(CodeObjects::NamespaceObject))
Expand Down

0 comments on commit 134be75

Please # to comment.