[Laszlo-dev] For Review: Change 20090130-hqm-Q Summary: support for swf9 incremental compilation

Donald Anderson dda at ddanderson.com
Fri Jan 30 12:15:04 PST 2009


It would be interesting.  java string compare (String.equals) first  
compares length first a shortcut, but still has to run through both  
strings on the typical case where they are equal.

On Jan 30, 2009, at 2:32 PM, Henry Minsky wrote:

> Yah, a hash would probably be smarter, I just thought we were CPU
> limited here with chewing over all these strings. I should try that
> and get a performance comparison.
>
>
> On Fri, Jan 30, 2009 at 12:40 PM, Donald Anderson  
> <dda at ddanderson.com> wrote:
>> Comments:
>>  LRUMap is not synchronized.  It would be better to use
>> public static final Map sIncrementalCompilationCache =
>> Collections.synchronizedMap(new LRUMap(10000));
>> I'm wondering if there is an mem space issue (or future issue) with  
>> keeping
>> up to 10000 file contents in a map.  Keeping an MD5 hash might give  
>> us
>> better growth.  Probably not worth doing until we know it's a  
>> problem.
>> (Trying to take the optimization rules to heart)  Maybe a code  
>> comment or
>> TODO?
>> Otherwise approved.
>> On Jan 30, 2009, at 11:28 AM, Henry Minsky wrote:
>>
>> I don't know if we want to merge this change  in yet, but I wanted  
>> to make
>> it up into a review package mostly to checkpoint it for possible
>> future use.
>>
>>
>> Change 20090130-hqm-Q by hqm at badtzmaru.home on 2009-01-30 11:13:21  
>> EST
>>   in /Users/hqm/openlaszlo/trunk3
>>   for http://svn.openlaszlo.org/openlaszlo/trunk
>>
>> Summary: support for swf9 incremental compilation
>>
>> New Features:
>>
>> Bugs Fixed:
>>
>> Technical Reviewer: dda
>> QA Reviewer: ptw
>> Doc Reviewer: (pending)
>>
>> Documentation:
>>
>> Release Notes:
>>
>> Details:
>>
>> This change allows the use of the swf9 flex compiler's 'incremental'
>> compilation option.
>>
>> The flex incremental compiler uses timestamps on the .as files, and a
>> cache db file of these timestamps, to determine which files to
>> recompile.
>>
>> So this change makes the script compiler write the intermediate .as
>> files to a deterministically named directory
>> (tmp/lzswf9/build/path-to-app/) and tries to ensure that only files
>> whose content is actually changed are modified on disk.
>>
>> For speed, this change adds an in-memory cache to the swf9 script
>> compiler of every intermediate .as file (which could get large I
>> imagine) to decide whether the content has changed on disk.
>>
>>
>> + adds 'compiler.swf9.incremental'  flag to lps.properties
>>
>> - This change doesn't add any way to pass the 'incremental' flag in
>> via query arg or command line args to the tag compiler. The only way
>> to set it right now is via the lps.properties file.
>>
>> Tests:
>>
>> compile a large test app with 300 view-classes (views with
>> constraints, that produce anonymous classes). The first compile takes
>> 20 seconds, the second incremental compile takes 16 seconds.
>>
>> About half the time is spent in the tag compiler and script compiler,
>> and the other half the time spent in the flex compiler (for the first
>> compile).
>>
>> More specifically when I call just the flex compiler by hand, the
>> first compile takes about 9 seconds, and the second (incremental)
>> compile takes about 2 seconds.
>>
>> So something is eating another three seconds, I think it is my code
>> which string-compares each cached javascript class file to determine
>> whether to rewrite the file on disk.
>>
>>
>> Files:
>> M      WEB-INF/lps/config/lps.properties
>> M      WEB-INF/lps/server/src/org/openlaszlo/sc/ 
>> ScriptCompilerInfo.java
>> M      WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
>> M      WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
>> M      WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
>> M
>>     WEB-INF/lps/server/src/org/openlaszlo/servlets/responders/ 
>> ResponderCompile.java
>> M      WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
>> M      WEB-INF/lps/server/src/org/openlaszlo/compiler/Parser.java
>>
>>
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090130-hqm-Q.tar
>>
>>
>> --
>> Don Anderson
>> Java/C/C++, Berkeley DB, systems consultant
>>
>> voice: 617-306-2057
>> email: dda at ddanderson.com
>> www: http://www.ddanderson.com
>>
>>
>>
>>
>>
>>
>
>
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com


--

Don Anderson
Java/C/C++, Berkeley DB, systems consultant

voice: 617-306-2057
email: dda at ddanderson.com
www: http://www.ddanderson.com





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20090130/6564276d/attachment.html


More information about the Laszlo-dev mailing list