Skip to content

Commit 134be75

Browse files
authored
Merge pull request #1454 from kk-ds-000/perf/dont-generate-unneeded-string
Avoid unnecessary string allocation when calculating length
2 parents 4fe39b6 + 7e7b413 commit 134be75

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/yard/registry_resolver.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def lookup_path_inherited(namespace, path, type)
132132

133133
path.scan(split_on_separators_match).each do |part, sep|
134134
cur_obj = nil
135-
pos += "#{part}#{sep}".length
135+
pos += part.length
136+
pos += sep.length
136137
parsed_end = pos == path.length
137138

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

0 commit comments

Comments
 (0)