Use String#<< instead of String#+=
I just couldn’t believe this but look: ~/jekyll/jekyll#master$ ruby benchmark/string-concat Calculating ------------------------------------- += 6367 i/100ms << 128697 i/100ms ------------------------------------------------- += 1704.3 (±0.6%) i/s - 12734 in 7.472170s << 4381212.4 (±6.3%) i/s - 21878490 in 5.014899s WOW.
This commit is contained in:
parent
1395d5686b
commit
0511ece2f5
|
@ -63,7 +63,7 @@ module Jekyll
|
|||
.gsub(/\A([^\/])/, '/\1')
|
||||
|
||||
# Append a trailing slash to the URL if the unsanitized URL had one
|
||||
url += "/" if in_url =~ /\/$/
|
||||
url << "/" if in_url =~ /\/$/
|
||||
|
||||
url
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue