I'm usually seeing less then 2x slower performance than native on average for code both in Firefox and Chrome (e.g. this voxel demo does a lot of stuff CPU work, both floating point and integer when producing new voxel mesh chunks, and the performance is at least in the same ballpark across all browsers and native versions: http://floooh.github.io/voxel-test/)
First thing I'd try is to run the code on Firefox, since this does AOT compile which guarantees that the code isn't 'de-optimized' during runtime. If you get any warnings about large functions during linking, look into emscripten's outlining feature which breaks large function bodies into smaller ones (large functions may confuse JIT JS engines) Next try traditional profiling, compile with optimization and the --profile option (this keeps function names readable), and run the code through the Javascript profiler in browser dev-tools, this should give you a good idea where most time is spent. I'm not sure about the state of 64-bit integer support in emscripten, but if your code is doing a lot of 64-bit integer stuff, this might be worth looking into. Also, if your code is doing WebGL stuff there are a number of additional things that can go wrong where WebGL has different performance behaviour than desktop, but from reading your description I guess that's not the case. Finally, it is possible that your code triggers a bug in the Chrome Javascript engine, that's why it is important to test on as many different browsers, platforms and browser versions as possible. Hope this helps, -Floh. Am Freitag, 8. April 2016 01:41:13 UTC+2 schrieb Gareth Morgan: > > I am experimenting with using Emscripten generated code in my Javascript > application. The results are pretty disappointing performance-wize. I am > seeing 40x slower on Chrome 49.0.2623.110 (compiling with emcc -o3) > versus a release build on visual studio. > > I have a fairly straight forward marching squares based geometry > generation function, running in a plain EXE complied with visual studio in > release mode, the function call takes around 2.5ms (as reported by > QueryPerformanceCounter), the identical function run in my javascript > appliction takes 90-100ms (measured by Date().getMilliseconds()). I have > verified the time scales roughly with the size of the problem, so it's not > just setup/JIT cost. > > My compile line is this; > emcc DCEL.cpp MS.cpp Blob.cpp -o html/Blob.js -O3 -s > EXPORTED_FUNCTIONS="['_Blobify','_Init']" > > > I realize there is no native code support on this version of Chrome, but > is this expected? Am I missing an optimization step? > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
