Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

needs performance improvements for "any-device" #4

Closed
supervisitor opened this issue Jul 21, 2020 · 5 comments
Closed

needs performance improvements for "any-device" #4

supervisitor opened this issue Jul 21, 2020 · 5 comments

Comments

@supervisitor
Copy link

like @jookia , last 2 days I check some devices. From the group of friends of my girlfriend and mine in Switzerland, I found more mobiles like this: Samsung A3, iPhone SE (5), Moto E LTE, Xperia Z5 comp., than the last modern from the major brands (I count 6 of about 50 from the last 10 months). All (without the 6 new!) of this need more than 30 sec., my one, a Galaxy S5 mini with a performance and battery life optimized Android 9 configuration (3-4d alive) needs 46 sec. with Anthony Restaino's Lightning Browser and consumed 1% of battery capacity! 😱
I think you should do some performance improvement work, to serve this users as a good experience too. 😇

@gzuidhof
Copy link
Collaborator

Thank you for taking the time to do this!

I think the first step for me is to decrease the default difficulty, I will decrease it by approximately 60%. This also makes it twice as cheap for attackers, but seeing as there are no known attackers (yet) I think the user experience is more important. The time it takes should decrease by approximately the same amount, making it more bearable for now..

I expect that these phones probably use the slower Javascript fallback solver, I am confident quite a lot of efficiency and speed performance can be squeezed out of this fallback still.

Another alternative way to improve the time it takes is to split the computation across two cores, phones often have multiple cores (but they are much slower than desktop CPUs).

@gzuidhof
Copy link
Collaborator

gzuidhof commented Jul 21, 2020

It's live now, could you perhaps try https://friendlycaptcha.com/demo on your device? It should be (on average) 61.45% faster. A minor update on the other issue: I have not been able to reproduce the focus problem on Opera for Windows, I will try later this week on my Mac device.

If anyone is reading this issue, knows low level Javascript well, the majority of time spent in the fallback solver is in adding 64 bit numbers. Javascript has no 64 bit integers, so instead every 64 bit number is represented as two 32bit numbers. This is the code that will benefit from optimization the most. There are multiple ways to do this addition, for sure my method is not the fastest around.

@supervisitor
Copy link
Author

... exact 30 sec. less: 16 sec.; this is about 65% faster! 😎

@gzuidhof
Copy link
Collaborator

I'm closing this issue, I think it's acceptable for old devices right now :). Of course always happy to see speedups contributed still.

@wwahammy
Copy link

@gzuidhof it might be worth looking at/importing BigInteger.js. I don't know offhand of their implementation is any better but at least it's not you having to do it from scratch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants