replit-archive / empythoned

CPython compiled to JS using emscripten
325 stars 44 forks source link

Closure Compiler Advanced Opts #4

Open kripken opened 13 years ago

kripken commented 13 years ago

It looks like only simple but not advanced opts are used. However advanced opts usually give a 50%-100% speedup (+smaller code).

Is there a reason for not using advanced opts? Do you need any help with something there?

max99x commented 13 years ago

Advanced opts don't work in some browsers. I'm afraid I don't remember which browsers were particularly problematic, but I can probably dig it up. For that matter, Opera breaks even with normal closure opts, so repl.it serves it an unclosured version. On a related note, reloop is much slower on Chrome (unlike Firefox), so that's served its special version too. The browser-file mapping is defined here.

Regarding performance, IIRC after the eliminator is run, Closure's effect is minimal in terms of runtime performance (but of course download time is much improved).

kripken commented 13 years ago

Very interesting.

I did some comparisons in the emscripten benchmarks, with either the eliminator, or closure, or both. Mostly the eliminator is about the same as closure, as you said (it's even a bit faster sometimes). However it is significantly slower in the raytrace benchmark, I suspect due to lack of inlining. I tend to suspect Python would benefit from inlining too, but I could be wrong.

Did you try with typed arrays (1 and 2)? How about QUANTUM_SIZE=1? (I assume the latter would not work, though)

max99x commented 13 years ago

IIRC my tests on Python produced negligible differences between Closure simple and advanced, but I'll recheck it next time I rebuild Empythoned. Haven't tried typed arrays or QUANTUM_SIZE=1 yet, since the performance we got was sufficient for a REPL, and I was too lazy to debug the issues that these optimizations might cause. Same as above, I'll give them a shot next time.