Done

On Mon, Jun 28, 2010 at 9:47 AM, Petr Kobalíček
<kobalicek.p...@gmail.com> wrote:
> I will, probably tomorrow, I'm not home and I haven't bugzilla password here:)
>
> On Thu, Jun 24, 2010 at 2:01 PM, thron7 <thomas.herchenroe...@1und1.de> wrote:
>> Petr,
>>
>> thanks, please add your thoughts to existing bug#2569. They'll fit there
>> nicely.
>>
>> T.
>>
>> On 06/24/2010 10:26 AM, Petr Kobalíček wrote:
>>> Hi devs,
>>>
>>> I have an idea how to improve (decrease) file size generated by
>>> qooxdoo generator and also how to increase the resulting performance.
>>> I tried to learn how generator works, but I was unable to modify its
>>> source code.
>>>
>>> The idea:
>>> ------------
>>>
>>> Qooxdoo is strongly namespaced and some classes are repeated many
>>> times in code. The 'qx.ui.table.cellrenderer' for example means 4 hash
>>> table lookup, modern javascript engine can optimize this (for example
>>> V8), but it's still code that needs to be evaluated each time its
>>> accessed. But because we know that this code will be never modified
>>> (class may be patched, but it will remain in namespace) we can use
>>> nice trick - assigning namespace to some variable to make name shorter
>>> and decrease lookup to only one hash-table (local identifier,
>>> optimized always by js-engine).
>>>
>>> so, imagine two classes in some namespace:
>>>
>>> qx.Class.define("qx.ui.table.cellrenderer.A",
>>>   extend: qx.ui.table.celldenrerer.Abstract,
>>>
>>>   construct: function() { /* some code */ },
>>>   members: {}
>>> );
>>>
>>> qx.Class.define("qx.ui.table.cellrenderer.B",
>>>   extend: qx.ui.table.celldenrerer.Abstract,
>>>
>>>   construct: function() { /* some code */ },
>>>   members: {}
>>> );
>>>
>>> Generator can produce something like this:
>>>
>>> declareNamespace = function()
>>> {
>>>   // implement me, create namespace...
>>> };
>>>
>>> // Begin of local scope, hide vars...
>>> (function() {
>>>
>>> // Some static functions can be assigned to variable, for example
>>> qx.Class.define is good candidate.
>>> var clsdef = qx.Class.define;
>>>
>>> // qx.ui.table.cellrenderer.Abstract was assigned to this before...
>>> var qx0 = ...;
>>>
>>> // Variables where classes are cached must be declared on top to scope.
>>> var qxA;
>>> var qxB;
>>>
>>> qxA = clsdef("qx.ui.table.cellrenderer.A",
>>>   extend: qx0,
>>>
>>>   construct: function() { /* some code */ },
>>>   members: {}
>>> );
>>>
>>> qxB = clsdef("qx.ui.table.cellrenderer.B",
>>>   extend: qx0,
>>>
>>>   construct: function() { /* some code */ },
>>>   members: {}
>>> );
>>> // End of local scope.
>>> })();
>>>
>>>
>>> Implementation in generator:
>>> ----------------------------------------
>>>
>>> - Collect all classes used (this is already in generator).
>>> - Declare local scope for each .js file.
>>> - For each class declare unique variable, unassigned (can be used var
>>> a, b, c, ... schema).
>>> - Replace occurences of qx.... with unique variables
>>> - Done:)
>>>
>>> Of course this can only work if qx.Class.define will be modified to
>>> return created Class object (simple).
>>>
>>> So what do you thing?
>>>
>>> Would be hard to do that? If I learn how to do it and write
>>> implementation, could be this optimization added to qooxdoo?
>>>
>>
>> ------------------------------------------------------------------------------
>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> lucky parental unit.  See the prize list and enter to win:
>> http://p.sf.net/sfu/thinkgeek-promo
>> _______________________________________________
>> qooxdoo-devel mailing list
>> qooxdoo-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>
>
>
> --
> Best regards
> - Petr Kobalicek <http://kobalicek.com>
>



-- 
Best regards
- Petr Kobalicek <http://kobalicek.com>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to