I've found that one of the the slow points for my video-decoding use case
on IE 11 is the Math.imul polyfill. libvpx's VP8 and VP9 decoders do a lot
of integer multiplication, as it turns out, but never (?) in ways that
would trigger 32-bit integer overflows...

I added a post-processing step to the asm.js builds of my VP8 and VP9
codecs, which finds all uses of the minified var assigned from
global.Math.imul and replaces it with straight multiplication:
https://github.com/brion/ogv.js/blob/master/buildscripts/strip-imul.js

With this in, I'm seeing roughly a 15-25% speedup in decoding in IE11
versus using the Math.imul polyfill! (Safari and Edge versions which
include Math.imul natively don't get any speedup, and newer versions will
get the Web Assembly builds anyway.)

This of course is a dangerous trade-off for general code -- it's possible
something will mis-optimize a legit multiplication that way -- but I
thought it might be an interesting tidbit some others might need.

-- brion

-- 
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 emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to