README.markdown in grosser-fast_gettext-0.3.2 vs README.markdown in grosser-fast_gettext-0.3.3
- old
+ new
@@ -1,8 +1,8 @@
FastGettext
===========
-GetText but 9.17 times faster, simple, clean namespace (7 vs 34) and threadsave!
+GetText but 7 times faster, simple, clean namespace (7 vs 34) and threadsave!
[Example Rails application](https://github.com/grosser/gettext_i18n_rails_example)
Setup
=====
@@ -37,25 +37,26 @@
Performance
===========
50_000 translations speed / memory
small translation file <-> large translation file
Baseline: (doing nothing in a loop)
- 0.410000s / 2904K <->
+ 0.460000s / 2904K
Ideal: (primitive Hash lookup)
- 1.150000s / 3016K <-> 1.130000s / 3016K
+ 1.180000s / 3016K <-> 1.140000s / 3016K
FastGettext:
- 1.800000s / 3040K <-> 1.750000s / 3040K
+ 2.180000s / 3036K <-> 2.430000s / 3152K
- GetText:
- 16.510000s / 5900K <-> 16.400000s / 6072K
+ GetText 2.0:
+ 15.250000s / 11784K <-> 15.640000s / 12192K
ActiveSupport I18n::Backend::Simple :
- 31.880000s / 10028K <->
+ 32.670000s / 12488K
+
Thread Safety and Rails
=======================
Parsed `text_domains` are not stored thread-save, so that they can be added inside the `environment.rb`,
and do not need to be readded for every thread (parsing takes time...).
@@ -75,11 +76,11 @@
include FastGettext::Translation
before_filter :set_locale
def set_locale
FastGettext.available_locales = ['de','en',...]
FastGettext.text_domain = 'frontend'
- sessions[:locale] = I18n.locale = FastGettext.set_locale(params[:locale] || sessions[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en')
+ session[:locale] = I18n.locale = FastGettext.set_locale(params[:locale] || session[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en')
end
#application_helper.rb
module ApplicationHelper
include FastGettext::Translation
@@ -112,6 +113,6 @@
======
Mo/Po-file parsing from Masao Mutoh, see vendor/README
[Michael Grosser](http://pragmatig.wordpress.com)
grosser.michael@gmail.com
-Hereby placed under public domain, do what you want, just do not hold me accountable...
\ No newline at end of file
+Hereby placed under public domain, do what you want, just do not hold me accountable...