Libvpx to WASM, facing performance issues.

215 views
Skip to first unread message

MEENA N SUBBIAH

unread,
May 30, 2020, 1:04:55 PM5/30/20
to emscripten-discuss
I am trying to compile the libvpx module to wasm.
But I am facing huge performance issues.

The wasm I build takes an average encode time of 1300+ milliseconds.
But I found another livpx.wasm  https://github.com/webrtc/apprtc/tree/wartc/src/web_app/wasm/libvpx which takes average encode time of 250+ milliseconds.
Can anyone help me, Where am I going wrong.

here are the compilation setting I use,

to build libvpx,

emconfigure ../node_modules/libvpx/configure --enable-postproc --enable-multi-res-encoding --enable-temporal-denoising --enable-libyuv --size-limit=16384x16384 --enable-multithread --enable-realtime-only --disable-install-docs --disable-unit-tests --disable-vp9-decoder --disable-vp9-encoder --target=generic-gnu --extra-cxxflags="-O3 -s WASM=1 -DWASM -I`dirname \`which emcc\``/system/lib/libcxxabi/include"
emmake make

to build libyuv,

emcmake cmake -DCMAKE_BUILD_TYPE=Release ../node_modules/libyuv
emmake make

Final compilation,

emcc -O3 -DWASM --bind -s STRICT=1 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=0 -s NO_EXIT_RUNTIME=1 -s MALLOC=emmalloc -s MODULARIZE=1 -s FILESYSTEM=0 -s EXPORT_ES6=1 --std=c++11 -o ./my-module.js -x c++ -I ./node_modules/libvpx -I ./node_modules/libyuv/include -I build-vpx src/zcon_ss.cpp src/Utility/ZvpxCodecInst.cpp src/Utility/zvpx_encoder.cpp src/Utility/zvpx_decoder.cpp build-vpx/libvpx.a build-yuv/libyuv.a  --no-entry --closure 0 --llvm-lto 3 -g0


Alon Zakai

unread,
May 31, 2020, 12:42:41 PM5/31/20
to emscripte...@googlegroups.com
For LTO you also need to pass -flto during the compile step (and during link, and you don't need `--llvm-lto 3` any more, which was for the old backend).

If that's not it, I'd suggest comparing profiles between the builds to find what is actually slower in your build.

--
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-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/e47d2054-9a4a-4cc5-86f9-bf0072f55258%40googlegroups.com.

MEENA N SUBBIAH

unread,
Jun 5, 2020, 10:40:48 AM6/5/20
to emscripten-discuss
I finally found out why my build is slower.

I build the wasm on a windows subsystem for linux, it was slower.
The when I build the same on a mac machine it is faster.

Is this expected behaviour?

steps to build -
1. clone the code from https://github.com/ankh-g/libvpx/tree/wartc  (branch 'wartc')
2. sh wasm.sh
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.

Thomas Lively

unread,
Jun 5, 2020, 1:53:52 PM6/5/20
to emscripte...@googlegroups.com
The OS you use when building the wasm shouldn't affect its contents or how fast it is. If you set EMCC_DEBUG=1 for the fast build and the slow build you might be able to see where the difference is.

To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

--
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-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/c177907a-af0b-43b2-ae31-1f53db84cca5o%40googlegroups.com.

Sam Clegg

unread,
Jun 5, 2020, 7:32:18 PM6/5/20
to emscripte...@googlegroups.com
On Fri, Jun 5, 2020 at 7:40 AM MEENA N SUBBIAH <zaap...@gmail.com> wrote:
I finally found out why my build is slower.

I build the wasm on a windows subsystem for linux, it was slower.
The when I build the same on a mac machine it is faster.

Is this expected behaviour?


No, you should get identical builds regardless of the build machine.

If you can show a different output for the same emsdk version on different operating systems that could be a bug.

steps to build -
1. clone the code from https://github.com/ankh-g/libvpx/tree/wartc  (branch 'wartc')
2. sh wasm.sh

On Sunday, May 31, 2020 at 10:12:41 PM UTC+5:30, Alon Zakai wrote:
For LTO you also need to pass -flto during the compile step (and during link, and you don't need `--llvm-lto 3` any more, which was for the old backend).

If that's not it, I'd suggest comparing profiles between the builds to find what is actually slower in your build.

On Sat, May 30, 2020 at 10:04 AM MEENA N SUBBIAH <zaap...@gmail.com> wrote:
I am trying to compile the libvpx module to wasm.
But I am facing huge performance issues.

The wasm I build takes an average encode time of 1300+ milliseconds.
But I found another livpx.wasm  https://github.com/webrtc/apprtc/tree/wartc/src/web_app/wasm/libvpx which takes average encode time of 250+ milliseconds.
Can anyone help me, Where am I going wrong.

here are the compilation setting I use,

to build libvpx,

emconfigure ../node_modules/libvpx/configure --enable-postproc --enable-multi-res-encoding --enable-temporal-denoising --enable-libyuv --size-limit=16384x16384 --enable-multithread --enable-realtime-only --disable-install-docs --disable-unit-tests --disable-vp9-decoder --disable-vp9-encoder --target=generic-gnu --extra-cxxflags="-O3 -s WASM=1 -DWASM -I`dirname \`which emcc\``/system/lib/libcxxabi/include"
emmake make

to build libyuv,

emcmake cmake -DCMAKE_BUILD_TYPE=Release ../node_modules/libyuv
emmake make

Final compilation,

emcc -O3 -DWASM --bind -s STRICT=1 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=0 -s NO_EXIT_RUNTIME=1 -s MALLOC=emmalloc -s MODULARIZE=1 -s FILESYSTEM=0 -s EXPORT_ES6=1 --std=c++11 -o ./my-module.js -x c++ -I ./node_modules/libvpx -I ./node_modules/libyuv/include -I build-vpx src/zcon_ss.cpp src/Utility/ZvpxCodecInst.cpp src/Utility/zvpx_encoder.cpp src/Utility/zvpx_decoder.cpp build-vpx/libvpx.a build-yuv/libyuv.a  --no-entry --closure 0 --llvm-lto 3 -g0


--
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-disc...@googlegroups.com.

--
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-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/c177907a-af0b-43b2-ae31-1f53db84cca5o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages