l10n object bloat and class PO

View: New views
5 Messages — Rating Filter:   Alert me  

l10n object bloat and class PO

by Johan Eenfeldt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Somewhat specialized questions, here...

Working on caching the $l10n object (responsible for 20-75% of
localized WordPress startup time) I've been banging my head a bit
against the wp-include/pomo/ classes.

$l10n is 3.3Mb out of the ~14Mb startup WP allocations in my test. At
least 750Kb of that appears to be totally unused.

Question 1: is class PO [1] (wp-includes/pomo/po.php) ever used?

I'm guessing it might possibly be in the WP.com admin generate plugin
pot stuff, but there doesn't seem to be anything in WordPress.

Question 2: is there any reason not to remove (or split out) the
members of class Translation_Entry which are only used by PO (and not
MO)?

Thanks,
Johan

[1] Localization files quick reference for the lazy: .po files are the
semi-user-friendly structured text files that are transformed to the
binary .mo files used by, among other programs, WordPress.
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: l10n object bloat and class PO

by Nikolay Bachiyski-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 15, 2009 at 17:45, Johan Eenfeldt <johan.eenfeldt@...> wrote:

> Somewhat specialized questions, here...
>
> Working on caching the $l10n object (responsible for 20-75% of
> localized WordPress startup time) I've been banging my head a bit
> against the wp-include/pomo/ classes.
>
> $l10n is 3.3Mb out of the ~14Mb startup WP allocations in my test. At
> least 750Kb of that appears to be totally unused.
>
> Question 1: is class PO [1] (wp-includes/pomo/po.php) ever used?
>
> I'm guessing it might possibly be in the WP.com admin generate plugin
> pot stuff, but there doesn't seem to be anything in WordPress.
>

Yes, whenever you are using translated version of WordPress, it is.

> Question 2: is there any reason not to remove (or split out) the
> members of class Translation_Entry which are only used by PO (and not
> MO)?

I am working on improving the PO/MO classes for both speed and memory
and I will have some actual results, soon. When I wrote the code my
initial tests didn't show that much of a difference as the real-world
usage did.

Happy hacking,
Nikolay.
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: l10n object bloat and class PO

by Johan Eenfeldt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for answering!

On Mon, Oct 19, 2009 at 11:15 AM, Nikolay Bachiyski <nb@...> wrote:
> On Thu, Oct 15, 2009 at 17:45, Johan Eenfeldt <johan.eenfeldt@...> wrote:
>> Question 1: is class PO [1] (wp-includes/pomo/po.php) ever used?
>>
>> I'm guessing it might possibly be in the WP.com admin generate plugin
>> pot stuff, but there doesn't seem to be anything in WordPress.
>
> Yes, whenever you are using translated version of WordPress, it is.

Could you give me a pointer? As far as I can see "class PO" is never
referenced anywhere.

>> Question 2: is there any reason not to remove (or split out) the
>> members of class Translation_Entry which are only used by PO (and not
>> MO)?
>
> I am working on improving the PO/MO classes for both speed and memory
> and I will have some actual results, soon. When I wrote the code my
> initial tests didn't show that much of a difference as the real-world
> usage did.

If there is anything to test or if you want any help anywhere I'm
working in this area again.

I saw http://core.trac.wordpress.org/ticket/10165 and was going to
look at that unless you are working on something else.

Thank you,
Johan
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: l10n object bloat and class PO

by Nikolay Bachiyski-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Oct 19, 2009 at 02:31, Johan Eenfeldt <johan.eenfeldt@...> wrote:
> I saw http://core.trac.wordpress.org/ticket/10165 and was going to
> look at that unless you are working on something else.

I want to try keep these as objects, since it makes more sense and is
a lot easier to both use and extend.

Only if there is no chance of keeping memory/CPU consumption in normal
bounds, I will resort back to big arrays and a lot of accompanying
functions.

Happy hacking,
Nikolay.
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: l10n object bloat and class PO

by Johan Eenfeldt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Oct 19, 2009 at 12:01 PM, Nikolay Bachiyski <nb@...> wrote:

> On Mon, Oct 19, 2009 at 02:31, Johan Eenfeldt <johan.eenfeldt@...> wrote:
>> I saw http://core.trac.wordpress.org/ticket/10165 and was going to
>> look at that unless you are working on something else.
>
> I want to try keep these as objects, since it makes more sense and is
> a lot easier to both use and extend.
>
> Only if there is no chance of keeping memory/CPU consumption in normal
> bounds, I will resort back to big arrays and a lot of accompanying
> functions.
>

Ok, I wish you luck! :) And if you want any assistance I'm available.

To return to the question that started this thread would you accept a
patch that split out:
Translation_Entry->translator_comments
Translation_Entry->extracted_comments
Translation_Entry->references_comments
Translation_Entry->flags

Perhaps into Translation_Entry_Full or Translation_Entry_PO or something?

My measurements of memory usage delta over load_textdomain:
2.9.rare: 4173844
2.9.rare-split-entry: 3220932

difference: 952912 / 2870 => 332bytes / entry

It is actually also measurable on pageloads (empty installation
frontpage translation enabled)
2.9.rare: 217ms on average
2.9.rare-split-entry: 199ms on average

Thanks
Johan
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers