react-native-simple-crypto icon indicating copy to clipboard operation
react-native-simple-crypto copied to clipboard

Performance of RSA decrypt

Open pke opened this issue 4 years ago • 4 comments

I am getting 20ms for a 4096bit RSA key decrypting on iOS and 223ms on Android consistently.

Some of the overhead is the React Native bridge, which we can not reduce I think. There are just 2 (relatively small) strings pushed over to the native side.

Could we increase the thread priority for decrypting?

pke avatar Feb 26 '21 23:02 pke

I am unsure what are good timings. 223ms on Android sounds terrible, I can look into how to speed this up but am no expert

ghbutton avatar Feb 27 '21 03:02 ghbutton

Maybe first step is to increase the task prio. It's currently running on normal prio. Should be highest possible before real-time.

pke avatar Feb 27 '21 08:02 pke

Another useful optimisation would be to support blob. Then a request response could be fed to this module without any overhead and directly read from it.

See https://gist.github.com/joshjhargreaves/b0d3f92e05d06d2dd3d6609698621641

pke avatar Feb 27 '21 18:02 pke

We can put blob storage as a feature request but increasing the priority on Android seems like a good first step here

ghbutton avatar Mar 03 '21 15:03 ghbutton