From 0511ece2f5b737ec0de96d01b8817ae570ff2518 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 22 Oct 2014 00:58:20 -0700 Subject: [PATCH] Use String#<< instead of String#+= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- lib/jekyll/url.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/url.rb b/lib/jekyll/url.rb index 964c619d..8773e018 100644 --- a/lib/jekyll/url.rb +++ b/lib/jekyll/url.rb @@ -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