This seems like a good optimization to me. The key will be whether it works
correctly for lzo compiles!
On 2012-03-02, at 03:57, Frank Guo wrote:
> 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
>
>
> <ClassModel.java><NodeModel.java><diff.txt><LzNode.lzs><LzDefs.lzs><embed-library.lzs>