Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Dec 22, 2020

Description

Avoids extra calls to Dart_NewStringFromCString, particularly on _drawFrame and _beginFrame, which are called once per frame. These calls may involve creating a VM safepoint, which ordinarily is cheap but sometimes shows up in traces as taking longer if there is more contention.

Related Issues

Fixes flutter/flutter#72117

Tests

Upstream performance tests should be mildly improved by this.

@@ -196,80 +196,109 @@ PlatformConfiguration::PlatformConfiguration(
PlatformConfiguration::~PlatformConfiguration() {}

void PlatformConfiguration::DidCreateIsolate() {
library_.Set(tonic::DartState::Current(),
Dart_LookupLibrary(tonic::ToDart("dart:ui")));
auto* library = Dart_LookupLibrary(tonic::ToDart("dart:ui"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The engine typically declares Dart handles explicitly as type Dart_Handle

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@dnfield dnfield merged commit 892034d into flutter:master Dec 28, 2020
@dnfield dnfield deleted the hooks branch December 28, 2020 17:34
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 28, 2020
gspencergoog pushed a commit to gspencergoog/engine that referenced this pull request Jan 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tonic::DartInvokeField creates a Dart_NewStringFromCString every time
3 participants