Optimisation of load_tables()

Bug #544876 reported by Данило Шеган
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php-gettext
Fix Released
Low
Данило Шеган

Bug Description

Got this email from Andrew Donkin:

> I haven't tested this but looking at the code it seems to me that
> load_tables() is seek()ing far more often that it needs to, if cache
> mode is disabled.
>
> function load_tables() {
> if (is_array($this->cache_translations) && <===========
> is_array($this->table_originals) &&
> is_array($this->table_translations))
> return;
>
> $this->cache_translations is never set if enable_cache is false, so
> load_tables() always performs the seeks and reads to initialise
> table_originals and table_translations.

Above statements are correct, so the only reasoning behind current behaviour might be that it allows MO files to change while application is executing. Not a very convincing reason to keep it, especially since you'll want to disable cache only for very large files where the memory footprint will outweight the benefits of caching.

So, let's fix it.

Related branches

Revision history for this message
Данило Шеган (danilo) wrote :

Fixed in r45 of lp:php-gettext.

Changed in php-gettext:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Данило Шеган (danilo)
status: Triaged → Fix Committed
Changed in php-gettext:
milestone: none → 1.0.10
Changed in php-gettext:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.