jsQR icon indicating copy to clipboard operation
jsQR copied to clipboard

JSQR is using too much CPU

Open alexolliveira opened this issue 7 years ago • 5 comments

JSQR is using a lot of CPU. When the cam is turned on, the use of cpu increases by 50%. How to solve this?

alexolliveira avatar Jul 31 '18 18:07 alexolliveira

So generally scanning images is going to use CPU. We've made strides to reduce the amount of CPU (and memory) that jsQR uses, especially in the v1 refactor. That said I certainly agree it could be better. #78 for example will cut down the CPU cycles per image by ~30% (when inverting is disabled) I think.

Going to keep this issue open to track general CPU improvements but we should probably try to define some metrics etc or we'll never be able to close it. Not sure if you have any ideas around that?

cozmo avatar Aug 15 '18 06:08 cozmo

Is it possible to move some of the processing to service workers somehow? We also find that especially from a live stream, it becomes almost impossible to scan a QR code on a phone.

adamreisnz avatar Jan 28 '19 09:01 adamreisnz

Check this out https://github.com/tigranbs/reactive-qr

henrylearn2rock avatar Jan 28 '19 11:01 henrylearn2rock

Thanks that looks good, I will try to refactor it for Vue.

adamreisnz avatar Jan 28 '19 21:01 adamreisnz

So generally scanning images is going to use CPU. We've made strides to reduce the amount of CPU (and memory) that jsQR uses, especially in the v1 refactor. That said I certainly agree it could be better. #78 for example will cut down the CPU cycles per image by ~30% (when inverting is disabled) I think.

Going to keep this issue open to track general CPU improvements but we should probably try to define some metrics etc or we'll never be able to close it. Not sure if you have any ideas around that?

Is there a way to destroy the scanner when it has grabbed a code? So it only is running when called. similar to this example:

any help appreciated thanks

FPWombot avatar Jan 18 '20 19:01 FPWombot