# Deprecating {{}} and welcoming %{}

**URL:** <https://www.ruby-forum.com/t/deprecating-and-welcoming/187874>\
**Category:** Rails I18n\
**Created:** [April 30, 2010, 6:58pm UTC](https://www.ruby-forum.com/t/deprecating-and-welcoming/187874 "2010-04-30T18:58:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![josevalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@josevalim](https://www.ruby-forum.com/u/josevalim)\
**Post date:** [April 30, 2010, 6:58pm UTC](https://www.ruby-forum.com/t/deprecating-and-welcoming/187874/1 "2010-04-30T18:58:05Z")

</div>

Hey guys,

I did a couple benchmarks related with using {{}} or %{} as  
interpolation option in message and got the following results.

## Using Ruby 1.9.1

{{}} 525.48 ms  
%{} 320.03 ms

## Using REE

{{}} 813.61 ms  
%{} 637.31 ms

This means a 40% improvement on using %{} over {{}} for Ruby 1.9.1 and  
20% for REE. T

Therefore I want to propose deprecating the current syntax in favor of  
%{}. But you may ask, why deprecate if both syntaxes works? The main  
reason is that we can just obtain these good results if we remove the  
gsub call:

> <https://github.com/ruby-i18n/i18n/blob/master/lib/i18n/backend/base.rb#L200>

Otherwise the improvement falls to half. So, what are your thoughts?

---

<div class="post-metadata">

**Author:** ![josevalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@josevalim](https://www.ruby-forum.com/u/josevalim)\
**Post date:** [April 30, 2010, 6:59pm UTC](https://www.ruby-forum.com/t/deprecating-and-welcoming/187874/2 "2010-04-30T18:59:16Z")

</div>

Ah, I must add that using %{} removes the need to use the  
interpolation compiler.

---

<div class="post-metadata">

**Author:** ![josevalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@josevalim](https://www.ruby-forum.com/u/josevalim)\
**Post date:** [April 30, 2010, 7:03pm UTC](https://www.ruby-forum.com/t/deprecating-and-welcoming/187874/3 "2010-04-30T19:03:56Z")

</div>

I think it’s a good idea. It improves performance and encourages  
developers to use standard Ruby 1.9 syntax as opposed to custom  
functionality specific to this library. As long as there’s a  
sufficiently long deprecation period, I really see no drawbacks.

-Norman

---

<div class="post-metadata">

**Author:** ![josevalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@josevalim](https://www.ruby-forum.com/u/josevalim)\
**Post date:** [April 30, 2010, 7:20pm UTC](https://www.ruby-forum.com/t/deprecating-and-welcoming/187874/4 "2010-04-30T19:20:56Z")

</div>

Ah, the benchmark performed the following operation:

I18n.backend.translate :en, :“activerecord.errors.models.user.blank”,  
:model  
=\> “User”, :attribute =\> “name”

With the following yml:

[i18n/benchmark/example.yml at master · ruby-i18n/i18n · GitHub](http://github.com/svenfuchs/i18n/tree/master/benchmark/example.yml)

---

<div class="post-metadata">

**Author:** ![josevalim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@josevalim](https://www.ruby-forum.com/u/josevalim)\
**Post date:** [May 3, 2010, 8:00am UTC](https://www.ruby-forum.com/t/deprecating-and-welcoming/187874/5 "2010-05-03T08:00:29Z")

</div>

Hi JosÃ©

Regardless the performance improvement, I had suggested to deprecate the  
{{}} months ago when %{} made it’s way into the rails code. I think it  
makes more sense to stick to standard ruby syntax (which can be  
optimized by the compiler) instead of sticking to a syntax that was  
invented for rails only.

Cheers,  
Lawrence
