[Laszlo-dev] I'd optimize OL code, I hope you can review the code

Frank Guo fguo at laszlosystems.com
Fri Mar 2 00:57:15 PST 2012


Hi Tucker , Max,

I'd optimized some code of OL. I read the out put js file.
I found when we add a new node or declare a new class,
OL will generate some code for $attributeDescriptor type property.
But most of them are duplicated. So I optimize this part.

I found the Attribute Type always be static.
I add a global variable, lz.ClassAttributeTypes, it is a map to store 
all the class attribute type map.
lz.ClassAttributeTypes["classname"]  = {name: string, id:ID ...}
If a class inherit from other class, I will merge its attributes type 
and its super class attributes type.
When declare a class or initialize a node,   $attributeDescriptor:  will 
reference the lz.ClassAttributeTypes["classname"]

To achieve that, I add two methods to NodeModel.java, 
getClassAttributeDescriptor, and getNodeAttributeDescriptor to handle 
the cases of class declaration and node instance declaration.

I think such change could minimize the output file size.

I attached file, hope you can review them.

thank

Frank Guo


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ClassModel.java
Type: text/x-java
Size: 54565 bytes
Desc: not available
Url : http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20120302/af0a04b8/ClassModel-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NodeModel.java
Type: text/x-java
Size: 108205 bytes
Desc: not available
Url : http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20120302/af0a04b8/NodeModel-0001.bin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff.txt
Url: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20120302/af0a04b8/diff-0001.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: LzNode.lzs
Url: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20120302/af0a04b8/LzNode-0001.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: LzDefs.lzs
Url: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20120302/af0a04b8/LzDefs-0001.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: embed-library.lzs
Url: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20120302/af0a04b8/embed-library-0001.pl


More information about the Laszlo-dev mailing list