ChromeKeePass
ChromeKeePass copied to clipboard
Reduce input detection CPU usage
This reduces the CPU consumption of the FieldSet generation and speeds up the progress.
I measured the runtime of the detectFields function:
| Test page | Runtime before the patch | Runtime with the patch | Approximated difference |
|---|---|---|---|
A simple page without password inputs |
0.319 ± 0.074 ms |
0.136 ± 0.033 ms |
-57% (~ 2.34x faster) |
A complex page with one password input (virustotal.com) |
0.322 ± 0.086 ms |
0.133 ± 0.032 ms |
-59% (~ 2.42x faster) |
The main improvement is not iterating over all the inputs, but rather searching for previous input elements starting from the password inputs.