Regards,
Max Carlson
OpenLaszlo.org
On 5/11/10 9:10 PM, Henry Minsky wrote:
I wanted to ask an architectural question about how to handle generating
.lzo's vs generating DHTML js1 output.
I've been working on making the same 'chunking' API for DHTML as I did
for swf10, where each call to
the ObjectWriter's "addScript()" method runs a piece of lzs code through
the backend compiler and writes it
to an output file, so we don't have to buffer the whole lzs and output
AST tree in memory.
If I want to use this 'chunking' API for lzo's should I have addScript()
write the script chunks out to a temp file? There's a method
in LibraryWriter which wants to run the whole lzs file through the js
parser, and then unparse it with the javascript compressor:
void exportScript() {
out.println("<script when='immediate' type='LZBinary'>\n<![CDATA[\n");
// Write 'compressed' output
org.openlaszlo.sc.parser.SimpleNode program =
(new
org.openlaszlo.sc.Compiler.Parser()).parse(scriptBuffer.toString());
// Cf., ScriptCompiler _compileToByteArray
JavascriptCompressor compressor = new
JavascriptCompressor(mProperties);
compressor.compress(program, out);
out.println("\n]]>\n</script>");
}
I'm wondering if I should modify this to run the chunks of script
through this path incrementally, on each call to addScript(), and stick
it into a temp file, or just say for the case of compiling an lzo that
we use the existing code in LIbraryWriter which buffers everything into
a giant string.
Given that recompiling LZOs should happen less often than compiling
applications tat include LZOs, I'd say buffering everything into a big
string is okay. We can always improve this later.