barcode-scanner-webassembly
barcode-scanner-webassembly copied to clipboard
The in browser demo runs very slow in mobile phone browser.
The demo works perfectly fine in the laptop browser but in mobile phone browser its lagging too much. I tried optimizing by using service workers but couldn't see much improvement. Are there any ways to improve the performance in the mobile browser?
Great question. Performance is actually one of the most important issues with this proof-of-concept. I've actually discussed potential approaches to improve this at the very end of the blog post accompanying this repo.. See the part below Performance is not fantastic yet....
Congrats for this project @jjhbw !
I tried it on a Samsung Galaxy smartphone and it is very slow indeed (1 fps or maybe 0.5 fps), and on my i5 laptop too. Do you think improvements of these last years about Wasm could improve the performance?
Interesting question, I would love to know about that too. You could try recompiling with the latest version of Emscripten to see if compiler/wasm improvements help.
However, I expect the most important bottlenecks to be inherent to the architecture. I haven't profiled it, but I expect that a lot of time is spent on copying image buffers from the canvas into webassembly land.
You could also look into flipping some of Zbar's (compile-time) switches to see if you can trade some fidelity or unused features for extra speed.
Hey guys @josephernest and @jjhbw! I have extracted the QR recognition code into a WebWorker. You can try this demo and check the performance on your devices ;)
[1] https://github.com/maslick/koder [2] https://qr.maslick.tech
@maslick very nice work! Thanks for posting it.