Skip to content

[web] (Potential) Performance regression when scrolling platform views. #115679

@ditman

Description

@ditman

There's a Link Widget test in the flutter/plugins repo that verifies that instances can be created/disposed of when the user flings the scroll.

This has started failing in one of the rolls, and the only solution I found to mitigate the issue was to diminish the "offset" by which the user scrolls the page (from 2500px to 800px), see the PR to mitigate the issue.

The error seems to come from the rendering layer:

══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
Assertion failed:
file:///usr/local/google/home/dit/github/flutter/packages/flutter/lib/src/rendering/object.dart:2951:12
attached
is not true

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49      throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3        assertFailed
packages/flutter/src/rendering/layer.dart.js 4462:32                              getTransformTo
packages/flutter/src/rendering/box.dart.js 1206:59                                localToGlobal
packages/flutter/src/widgets/title.dart.js 23716:20                               <fn>
packages/flutter/src/scheduler/binding.dart.js 866:9                              [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart.js 839:37                             handleDrawFrame
packages/flutter_test/src/test_text_input_key_handler.dart.js 3034:15             handleDrawFrame
packages/flutter/src/scheduler/binding.dart.js 752:12                             [_handleDrawFrame]
dart-sdk/lib/async/zone.dart 1398:13                                              _rootRun
dart-sdk/lib/async/zone.dart 1300:19                                              run
dart-sdk/lib/async/zone.dart 1208:7                                               runGuarded
lib/_engine/engine/platform_dispatcher.dart 1170:9                                invoke
lib/_engine/engine/platform_dispatcher.dart 218:5                                 invokeOnDrawFrame
lib/_engine/engine/initialization.dart 190:45                                     <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39  dcall
════════════════════════════════════════════════════════════════════════════════════════════════════

The test is tripping in an old assertion that is now failing.

I think we should decide if this is a performance regression that needs to be fixed, or that we were using scrollUntilVisible wrong.

Steps to Reproduce

  1. Prepare flutter: d2e6dfefa5ca
  2. Prepare plugins: flutter/plugins@017e776
  3. Ensure the correct chromedriver is running for your version of Chrome
  4. In plugins, go to: cd plugins/packages/url_launcher/url_launcher_web/example/
  5. Run the driver tests by hand:
    • flutter run -d web-server --web-port 7357 --target integration_test/link_widget_test.dart
  6. Point your Chrome browser to localhost:7357 with the debug console open.
  7. You'll see the error I pasted above (many times!)

Expected results: The test should pass.

Actual results: The test doesn't pass unless the delta value of scrollUntilVisible in the link_widget_test.dart is tweaked to something low.

Code sample

The code is in the repos, just to reiterate:

Logs

Important: Logs only show up in the javascript console of the browser, not in the output of the tool!

Doctor
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel unknown, 3.6.0-6.0.pre.9, on Debian GNU/Linux rodete 5.18.16-1rodete4-amd64, locale
    en_US.UTF-8)
    ! Flutter version 3.6.0-6.0.pre.9 on channel unknown at /usr/local/google/home/dit/github/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at
      https://flutter.dev/docs/get-started/install.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.72.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listcustomer: thoughts (g3)f: scrollingViewports, list views, slivers, etc.perf: speedPerformance issues related to (mostly rendering) speedplatform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions