Deprecating {{}} and welcoming %{}

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:

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

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

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.


Ah, the benchmark performed the following operation:

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

With the following yml:

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.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs