phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [phpGroupWare-developers] Proposal for method of using application-r


From: Sigurd Nes
Subject: Re: [phpGroupWare-developers] Proposal for method of using application-related translation
Date: Sun, 10 Feb 2008 18:02:19 +0100
User-agent: Thunderbird 2.0.0.9 (X11/20080207)

Dave Hall wrote:
> On Sat, 2008-02-09 at 17:04 +0100, Sigurd Nes wrote:
>> There is a very simple way to avoid the whole problem:
>> In front of the menu-translation-block - if needed: set the
>> $GLOBALS['phpgw_info']['flags']['currentapp'] to the application in
>> question, and put it back to the incoming value after it is finished.
> 
> That is uglier than the original proposal.  The currentapp flag
> shouldn't be manipulated like that.
> 
> I spent some time today benchmarking the 2 versions of code using my
> ReSight working copying (which is mostly up to date).
> 
> The test involved creating an array of the unique strings to be
> translated from property and calendar's menu classes.  This resulted in
> 87 strings to be translated.  The test was executed 500 times each, with
> a 1 second wait between page refreshes.  There was no header or navbar
> loaded and only the time spent processing the translations was measured.
> It was run with and without shm.  
> 
> The figures below are average execution times.
> 
> $only_common version of the code
> without shm: 0.01280 sec
> with shm:    0.01143 sec
> 
> $appname version of the code
> without shm: 0.01720 sec
> with shm:    0.01394 sec
> 
> The figures above show that using the only_common check is faster.
> 
> Given that the translation code is probably the most used part of the
> API in any script execution, it should be highly optimised.  In the
> initial menu load, this can easily be called 200 times.  In most pages
> it would be called 20 to 50 times - sometimes more.
> 

Thanks for taking the time for looking into the code.
A bit disappointing that the shm didn't perform much better.

The menu is supposed to be loaded only once per session - right?
How about having one super-quick, speed-optimized function for the normal 
translations - and one slightly slower for the rare occasions (some apps
during menuload) that would need translations related to appnames?

Regards

Sigurd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]