clients icon indicating copy to clipboard operation
clients copied to clipboard

Autofill performance regression, even when autofill is disabled

Open toupeira opened this issue 7 months ago • 12 comments

Summary

The autofill performance degradation from https://github.com/bitwarden/clients/issues/17090 has returned in 2026.3.0.

It originally showed up in 2025.10.0 and was fixed in 2025.12.0, and 2026.2.0 still seems good too. AFAIK the problem was introduced in 6129ca5366 and related to component-heavy sites using many shadow DOMs, and this commit was reverted in c04c1757ea for the fix.

I see there was some recent work around shadow DOMs again in f9dff532a6, along with performance specs, and while it does seem a bit less egregious than last time it's still very noticeable for me in the form of cursor lag on sites like YouTube or Reddit.

Steps To Reproduce

Example 1:

  1. Go to https://www.youtube.com/
  2. Focus the search field and hold down a key, e.g. i
  3. Observe the input lagging every second or so

Example 2:

  1. Go to a random YouTube video
  2. Move the mouse over the timeline to show the preview images
  3. Observe the preview images lagging every second or so

Note: you might need to test on an older machine or throttle your CPU to see this

Expected Result

The autofill code shouldn't degrade performance.

What really bugs me is that I don't even use autofill:

  • "Show autofill suggestions on form fields" is disabled
  • "Autofill on page load" is disabled

So it would be really neat if the extension could not run these expensive autofill watchers at all in this case.

I do use the fill keyboard shortcut and filling from the extension window, but surely the extension could just find the form fields once when those actions are triggered?

Actual Result

The autofill code introduces lags.

Screenshots or Videos

Firefox profile: https://share.firefox.dev/41tdVUx

The offending call stack looks similar as in https://github.com/bitwarden/clients/issues/17090#issuecomment-3470662755:

nodeIsElement [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:5148:23]
getShadowRoot [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:8878:18]
buildTreeWalkerNodesQueryResults [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:8920:37]
queryAllTreeWalkerNodes [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:8905:28]
query [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:8766:10]
queryAutofillFormAndFieldElements [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:22231:38]
getPageDetails/< [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:21660:89]
InterpretGeneratorResume [self-hosted:1312:34]
next [self-hosted:1233:23]
collect_autofill_content_service_awaiter</< [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:21349:46]
collect_autofill_content_service_awaiter< [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:21347:95]
getPageDetails [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:21659:19]
requestIdleCallbackPolyfill/< [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://<URL>:4937:47]
requestIdleCallback handler

Operating System

Linux

Web Browser

Firefox

Browser Version

149.0.2

Environment Versions

Version: 2026.3.0

SDK: 'main (7637fdf)'

Server version: 2026.3.2

Issue Tracking Info

  • [x] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.

toupeira avatar Apr 10 '26 23:04 toupeira

Thank you for reporting this issue! We've added this to our internal tracking system. ID: PM-34923 Link (for internal use): https://bitwarden.atlassian.net/browse/PM-34923

bitwarden-bot avatar Apr 10 '26 23:04 bitwarden-bot

... adding [web] to the title actually makes it more confusing, since the tag "web" in this repository stands for the web vault - and not the browser extension.

pamperer562580892423 avatar Apr 11 '26 00:04 pamperer562580892423

Hi there,

I am unable to reproduce this issue, it has been escalated for further investigation. If you have more information that can help us, please add it below.

Thanks!

daniellbw avatar Apr 13 '26 07:04 daniellbw

@daniellbw please try with Firefox and an older computer. I checked on a faster computer now and the lag is much less noticeable there, but still present if you watch closely.

I went looking for a browser benchmark that exposes the problem but couldn't find one, so had an LLM whip up something. It inserts and removes elements with shadow DOMs and measures throughput and latency. You can find it online at https://jsfiddle.net/vt8gak60/

Benchmark results

Here are my results in Firefox, comparing the performance with the extension disabled, and versions 2026.3.0 and 2026.2.0:

Fast computer (Ryzen 7700X) Slow computer (i5-7260U)
Image Image

This doesn't show a meaningful difference between 2026.3.0 and 2026.2.0, but does illustrate that the extension has a noticeable impact on throughput and introduces latency spikes.

I don't really use Chrome but have it installed, and while its overall performance is much better and the difference with the extension enabled much smaller, there is still an impact:

Image

(this was on the fast machine, and I don't know how to install previous extension versions in Chrome so I skipped that)

But really my main point is that the extension is adding a performance penalty on many websites, for a feature (autofill) that I don't even have enabled.

toupeira avatar Apr 13 '26 12:04 toupeira

I can confirm the exact behavior described by @toupeira. Here is a video of me holding down the i key in the YouTube search bar.

Image

Hovering over videos on the subfeed also causes lags for the background highlighting as well as the timeline previews.

Excluding youtube.com from autofill domains fixes the issue.

My system has an old Haswell Xeon:

Operating System: Fedora Linux 43 KDE Plasma Version: 6.6.4 KDE Frameworks Version: 6.25.0 Qt Version: 6.10.3 Kernel Version: 6.19.11-200.fc43.x86_64 (64-bit) Graphics Platform: Wayland Processors: 8 × Intel® Xeon® CPU E3-1240 v3 @ 3.40GHz Memory: 16 GiB of RAM (15,5 GiB usable) Graphics Processor: NVIDIA GeForce RTX 2070

Firefox 149.0.2 (fedora rpm) Bitwarden Browser Extension 2026.3.0

flashyv avatar Apr 13 '26 16:04 flashyv

Also having this with autofill disabled.

redrifle avatar Apr 16 '26 21:04 redrifle

I can confirm this regression too on Firefox and Windows 10. The most obvious performance degradation is on Youtube, both on the search bar and the timeline bar. There's a video on this thread reflecting the issue:

https://github.com/bitwarden/clients/issues/17090#issuecomment-3459554188

Floyd77 avatar Apr 20 '26 18:04 Floyd77

I am experiencing the exact same issue. The YouTube progress bar stutters/lags at a fixed frequency whenever the Bitwarden extension is enabled. :/

My Environment:

Device: Acer Swift 3 Laptop

Operating System: Arch Linux (using XFCE desktop environment)

Browser: Mozilla Firefox 150.0 (Arch Linux package)

Bitwarden:
 Version: 2026.3.0
 SDK: 'main (7637fdf)'
 Server version: 2026.4.0

https://github.com/user-attachments/assets/433df1ea-21bb-4bfe-8f26-d2367a3bdf8c

Simon-Xu-209 avatar Apr 24 '26 15:04 Simon-Xu-209

Still the same on 2026.4.0, so I downgraded to 2026.2.0 again.

Is anybody from Bitwarden following this issue? Is my conclusion in the issue description wrong that this is pretty much the same performance regression which was previously reverted for 2025.12.0?

toupeira avatar May 29 '26 22:05 toupeira

Still the same on 2026.6.1...

toupeira avatar Jul 22 '26 19:07 toupeira

I reproduced a large performance regression caused by the autofill script-delivery path on WebKit and would like to propose reusing the registered-content-script architecture already used by the FIDO2 module.

Reproduction

With the same Release browser build and clean process, Speedometer 3.1 scores around 47–48 without the extension and around 19 with Bitwarden 2026.8.0 enabled. I also built an isolated fixture that performs equivalent document_start / all_frames work:

  • per-frame dynamic executeScript: 285 frames/s median
  • declarative content script: 1,734 frames/s median
  • scripting.registerContentScripts: 1,987 frames/s median

The registered path was 6.96x faster in this delivery-focused fixture. Speedometer is not a proxy for every real-world workflow, but the frame amplification makes the delivery overhead easy to isolate.

The current path is:

trigger-autofill-script-injection.js -> background message -> AutofillService.injectAutofillScripts() -> one executeScript call per selected file and frame.

This aligns with the script/bootstrap stalls reported in #20678 and is complementary to the DOM-observer improvements already being developed for this issue.

Proposed change

  1. Register the selected autofill bootstrap and context-menu content script once, using the same MV2/MV3 abstraction pattern as FIDO2.
  2. Re-register when authentication state or inline-menu/notification settings change.
  3. Keep the existing trigger minimal for frame lifecycle monitoring.
  4. Preserve dynamic injection as a fallback for existing tabs, manual actions, startup races, and unsupported registration paths.
  5. Preserve blocked-interaction URI behavior and avoid duplicate bootstrap/observers.
  6. Add coverage for automatic/manual autofill, overlays, lock/logout, iframes, passkeys, blocked domains, and MV2/MV3 lifecycle.

I am preparing a draft PR with tests and an A/B benchmark. Does this direction fit the maintainers' planned work for this regression?

LuizFelipe-LF avatar Sep 03 '26 13:09 LuizFelipe-LF

The originally reported bug (youtube scrobber rendering jank) no longer seems to be reproducible, and some of the subsequent reports are referencing other kinds of performance issues, so we're closing this one for now.

That said, we're continuing to invest in this area. For example, we have some work around our content script injection strategies as well as mutation observers in the pipeline. Thank you for letting us know where you've been running into issues!

jprusik avatar Sep 25 '26 19:09 jprusik