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:
http://github.com/svenfuchs/i18n/blob/master/lib/i...
Otherwise the improvement falls to half. So, what are your thoughts?
on 2010-04-30 18:58
on 2010-04-30 18:59
Ah, I must add that using %{} removes the need to use the
interpolation compiler.
on 2010-04-30 19:03
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
on 2010-04-30 19:20
Ah, the benchmark performed the following operation: I18n.backend.translate :en, :"activerecord.errors.models.user.blank", :model => "User", :attribute => "name" With the following yml: http://github.com/svenfuchs/i18n/tree/master/bench...
on 2010-05-03 08:00
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
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.