News for hackers. Stuff that matters.
Re:TodoMVC in Rust by girvo on Wednesday September 23, 2015 @07:04AM (#10264309)
For something compiled with Emscripten, this was stupid quick to startup. Wow.
Re:TodoMVC in Rust by flohofwoe on Wednesday September 23, 2015 @10:18AM (#10265108)
I had to check and the generated .js file is 248kByte compressed, 787kByte uncompressed. That's in the same ballpark as a comparable C++ demo, looking at the code it is even a bit big (e.g. my emscripten demos here are between 100kByte and 500kbyte: http://floooh.github.io/oryol/).

There is some inherent size overhead because the linked parts of the C runtime library and C++ std lib are part of the emscripten-generated JS (std::iostream and printf seem to be the biggest offenders on the C++ and C side) while on some native platforms this code lives in DLLs, but gzipped asm.js code itself isn't bigger than its gzipped 'native equivalent' (usually within +/- 10%).

It is easy to created bloated code with emscripten, especially when using C++ instead of C, but for the same reasons the code would also be bloated as native executable (e.g. massive use of template and inline code).

Re:TodoMVC in Rust by timcameronryan on Wednesday September 23, 2015 @02:01PM (#10266750)
I was impressed too. I think the key is that it injects all of the HTML at once. Compare that to e.g. the Backbone.js implementation which uses progressive enhancement: http://todomvc.com/examples/backbone/

The code can be optimized further with Closure Compiler, but I wonder if that decreases startup speed.