# Re: String performance

**URL:** <https://www.ruby-forum.com/t/re-string-performance/81554>\
**Category:** Ruby\
**Created:** [January 9, 2007, 10:02pm UTC](https://www.ruby-forum.com/t/re-string-performance/81554 "2007-01-09T22:02:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [January 9, 2007, 10:02pm UTC](https://www.ruby-forum.com/t/re-string-performance/81554/1 "2007-01-09T22:02:48Z")

</div>

From: George P.

> Guys a quick performance question - Is either one of the following  
> more efficient than the other? I’m guessing they’re in this order:
> 
> ‘a’ + x + ‘b’  
> “a” + x + “b”  
> “a#{x}b”

Despite the intuition, I’ve never been able to prove that “foo” vs.  
‘foo’ is measurably slower or faster.

String interpolation is, however, faster than either of the above. (I’m  
not sure why, but my guess is that it has to do with how many  
intermediary strings are created.)
