[Twisted-web] canvas without flash and optimization patches

Steven Armstrong sa at c-area.ch
Mon Feb 21 09:45:58 MST 2005

On Mon, 21 Feb 2005 16:17:48 +0100 Stefano Debenedetti wrote:
> Hello,
> I did some further tests on Canvas, the compilation errors I got with KineticFusion were definitely trivial (only two missing semicolons) so I prepared a little patch that corrects those and adds the RVML file, which includes a comment with instructions for downloading KineticFusion and building the Canvas SWF with it.
> I also turned compression on for a further size improvement, now the generated SWF is less than 2KB.
> Perhaps more importantly, I found out why the Canvas demo is crashing Mozilla/Firefox on linux: it is too fast (i.e. the linux Flash player is too crappy)! Indeed it is not crashing, if you stop the server the browser resurrects, so I guess it is more appropriate to call it a choke.
> The demo uses twisted.internet.task to send commands to the client approximatively every 0.25 seconds, raising that value to 0.3 is enough to avoid the choke, at least on my system.
> So I tried optimizing the canvas.as file and I found out that by changing the Canvas protocol in order to use plain old crappy TSV instead of XML gives it a performance boost that allows me to push the above mentioned refresh rate of the demo to 0.21, i.e. even better than the 0.25 that was unreachable before.
> Of course this has other drawbacks, for example you have take care of potential conflicts between the separator token you choose and the string data you want to send to the client, you lose ease of extensibility of the hierarchical structure and so on but it's worth giving it a try when the goal is absolute performance.
> The first patch I attach is just the semicolons fixes + the RVML file, the second one is the same plus the optimizations, sorry about the data duplication but I couldn't figure out a quick way to do incremental patches with SVN without committing first.
> ciao
> ste

Wouldn't it be possible to use something like JSON [1] instead of XML?
Like that you may have the best of both worlds. Structured data and a
lighter format than xml. JS and Python work very nicely with it.

[1] http://www.json.org


All I know is that I know nothing -- Socrates

More information about the Twisted-web mailing list