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

Peformance improvement : reduce engine init time 50%off at least #17192

Closed
wants to merge 1 commit into from

Conversation

lucky-chen
Copy link

@lucky-chen lucky-chen commented Mar 18, 2020

Hi, this pr try to reduce engine init time. In our data, init engine cost too much time: Android 300ms, iOS 380ms(most are mid-end and low-end machine)。

In our local test. Android reduce about 66.3% time,and iOS reduce about 46.6% time.

update:

Introduction change

Cause there are 15 files change, so Introduction to changes.

In fact , core modification all in shell.cc ,new method CreateAsync and CreateShellAsyncOnPlatformThread, other modification most are adapter code(android、iOS) and test。

  • engine (Core modification , also can work on other platform, just adapter Android/iOS now)
    • runtime
      • shell.h
      • shell.cc
    • test
      • shell_benchmarks.cc
      • shell_unittests.cc
  • adapter iOS
    • runtime:
      • FlutterEngine.mm
      • FlutterEngine.h
    • test:
      • FlutterEngineTest.mm
  • adapter android
    • runtime:
      • FlutterEngine.java
      • FlutterJNI.java
      • platform_view_android_jni.h/.cc
      • android_shell_holder.h /.cc
      • FlutterNativeView.java
    • test:
      • EngineLaunchE2ETest.java

ApiUsage

  • Android
final FlutterEngine engine = new FlutterEngine();
engine.initAsync( this,new EngineLifecycleListener() {
    public void onAsyncCreateEngineEnd(boolean success) {
        if (success) {
            engine.getDartExecutor().executeDartEntrypoint(DartEntrypoint.createDefault());
         } else {
            //balaba
        }
}});
  • iOS
 FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"my flutter engine"];
  [flutterEngine asyncRun:^(boolean success) {
    if (success) {
       [GeneratedPluginRegistrant registerWithRegistry:self];
    }else{
       //balaba
    }
  }];

@auto-assign auto-assign bot requested a review from stuartmorgan-g March 18, 2020 10:22
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@lucky-chen
Copy link
Author

@googlebot I signed it!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@lucky-chen lucky-chen force-pushed the master_async_init_pr branch from d1aabd7 to 9fd15dc Compare March 18, 2020 11:10
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@lucky-chen lucky-chen force-pushed the master_async_init_pr branch from 326a1c4 to 7c4d86b Compare March 18, 2020 11:59
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@lucky-chen lucky-chen force-pushed the master_async_init_pr branch 2 times, most recently from 44e8981 to 1ef74bf Compare March 18, 2020 12:17
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@liyuqian
Copy link
Contributor

@lucky-chen : flutter/tools/gn --runtime-mode=profile should generate an out/host_profile folder. Then ninja -C out/host_profile should build the shell_benchmarks binary. You can then run that binary to get benchmark numbers.

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

This is a good start and this model is definitely something we want to get to but there are some concerns we need to address first.

All Flutter engine APIs assume that the shell is ready to use after a valid reference to the same has been obtained via a call to Shell::Create. Now, depending on whether the Shell::Create call was made with the async_init_callback, all components that have access to the shell now have to wait for the callback to run. We want an API that doesn’t put the burden on the owner of a shell reference to know when said reference is safe to use. For example, if I were to vend a reference to the shell created using this callback specified to a component that needed its engine reference (by calling Shell::GetEngine), that component would have no idea if and how long to wait till it's safe to call GetEngine (or really, any other call on the shell). In fact, more worryingly, since the engine weak pointer has not been initialized yet, the call to GetEngine will now return a null weak pointer which will make the caller think that the shell has died already! As you can see, this API breaks some invariants in the Flutter Engine.

I think we can achieve the improvements without breaking the invariant described above though. Instead of adding just another argument to the Shell::Create call and vending a semi-instantiated shell, consider an API that just returns the shell itself in the callback. Now, shell initialization can begin but the reference will be vended to the caller only when it is safe to use. The caller can’t work on a semi-initialized engine because it won’t have a reference to it. The API would look something like. bool CreateShell(std::function<std::unique_ptr<Shell>()> shell_callback, … other arguments). When updating the iOS and Android embeddings, you can wait for the entire shell reference in the callback. This should not be an issue as it was not safe to use the shell reference before the callback anyway.

Also, please add a test for this in the shell_unittests target as that is the primary test target for this component.

@liyuqian liyuqian self-requested a review March 26, 2020 22:03
@chinmaygarde
Copy link
Member

@kangwang1988 I already left a review and see no updates or followup comments. Would you like me to clarify something?

@kangwang1988
Copy link
Contributor

@chinmaygarde
I mistakenly thought the refresh icon would trigger a double check over those resolved conversations. It's a misoperation over github. Please ignore it.

@lucky-chen lucky-chen force-pushed the master_async_init_pr branch 2 times, most recently from 852fe7e to 4acbe5e Compare April 3, 2020 09:57
@lucky-chen
Copy link
Author

lucky-chen commented Apr 3, 2020

hi,all, update finish .

benchmark

@liyuqian add benchmarks on shell_benchmark.cc. BM_ShellInitializationAsyncLockTime (LockTime) and BM_ShellInitializationAsyncTotalTime (LockTime + asyncTime)

Run on (8 X 2200 MHz CPU s)
2020-04-03 14:30:07
Benchmark                                     Time           CPU Iterations
---------------------------------------------------------------------------
BM_ShellInitialization                  4303584 ns    1033192 ns        689
BM_ShellShutdown                         900391 ns     377524 ns       1909
BM_ShellInitializationAndShutdown       5047434 ns    1225929 ns        574
BM_ShellInitializationAsyncLockTime     1186484 ns     996315 ns        648
BM_ShellInitializationAsyncTotalTime    4285084 ns    1014661 ns        694

ShellTestCase

@chinmaygarde add testcase on shell_unittests, adn all case run success

[ RUN      ] ShellTest.AsyncInitializeWithMultipleThreadButCallingThreadAsPlatformThread
[       OK ] ShellTest.AsyncInitializeWithMultipleThreadButCallingThreadAsPlatformThread (13 ms)

Introduction change

Cause there are 15 files change, so Introduction to changes.

In fact , core modification all in shell.cc ,new method CreateAsync and CreateShellAsyncOnPlatformThread, other modification most are adapter code(android、iOS) and test。

  • engine (Core modification , also can work on other platform, just adapter Android/iOS now)
    • runtime
      • shell.h
      • shell.cc
    • test
      • shell_benchmarks.cc
      • shell_unittests.cc
  • adapter iOS
    • runtime:
      • FlutterEngine.mm
      • FlutterEngine.h
    • test:
      • FlutterEngineTest.mm
  • adapter android
    • runtime:
      • FlutterEngine.java
      • FlutterJNI.java
      • platform_view_android_jni.h/.cc
      • android_shell_holder.h /.cc
      • FlutterNativeView.java
    • test:
      • EngineLaunchE2ETest.java

ApiUsage

  • Android
final FlutterEngine engine = new FlutterEngine();
engine.initAsync( this,new EngineLifecycleListener() {
    public void onAsyncCreateEngineEnd(boolean success) {
        if (success) {
            engine.getDartExecutor().executeDartEntrypoint(DartEntrypoint.createDefault());
         } else {
            //balaba
        }
}});
  • iOS
 FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"my flutter engine"];
  [flutterEngine asyncRun:^(boolean success) {
    if (success) {
       [GeneratedPluginRegistrant registerWithRegistry:self];
    }else{
       //balaba
    }
  }];

@lucky-chen lucky-chen force-pushed the master_async_init_pr branch from 4acbe5e to 9e36331 Compare April 3, 2020 12:50
 - add Shell::CreateAsync mode
 - supprot android && ios
 - add testcase for engine、Android、iOS
 - add benchmamrk on shell_benchmark.cc
@lucky-chen lucky-chen force-pushed the master_async_init_pr branch from 9e36331 to 3fc6fb4 Compare April 7, 2020 03:01
Copy link
Contributor

@liyuqian liyuqian left a comment

Choose a reason for hiding this comment

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

Thank you for adding more benchmarks and tests!

A quick question: do you only expect the 50% init time reduction on add-to-app, or do you also expect such reduction on standalone Flutter Android/iOS apps?

Here's why I'm asking that:

While BM_ShellInitializationAsyncBlockTime and BM_ShellInitializationAsyncTotalTime are certainly nice to have, they don't tell a full story of your improvement. Specifically, those two benchmarks can't be run before your PR, so we couldn't use them to quantify your speedup.

Therefore, I tried to use our complex_layout__start_up test to compare the startup time before and after your PR, but I can't see a significant difference. You can run that test locally by running ../../bin/cache/dart-sdk/bin/dart bin/run.dart -t complex_layout__start_up --local-engine=android_profile inside flutter/flutter/dev/devicelab once you get your local engine compiled in profile mode.

I'd encourage you to write an independent benchmark like complex_layout__start_up to reveal your improvement. You can write a smaller PR to just include that benchmark. Smaller PRs also make it much easier for code reviews. As a result, your change will be approved and get merged faster 😄

if (asyncInitCallback == null) {
Log.w(
TAG,
"initAsync: callback is null, you should care lifecycle, and called other api after initCallback called");
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the Chinese version of this message? I'm having a little difficulty in understanding the English...

Copy link
Author

@lucky-chen lucky-chen Apr 7, 2020

Choose a reason for hiding this comment

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

在异步模式中您需要关心初始化完成的时机,建议设置callback,并在callback触发后再调用其它api。😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the following warning is a better translation: "initAsync: asyncInitCallback is null. Please be careful about the lifecycle and when the initialization is done. We recommend to set an asyncInitCallback, and call other APIs after such callback is executed."

@lucky-chen
Copy link
Author

lucky-chen commented Apr 7, 2020

@liyuqian

add to app/Standalone

Just for add to app mode. At present, almost no one use standalone mode for existed apps.

benchmark:

Should compare BM_ShellInitializationAsyncLockTime with BM_ShellInitialization
And must use new api to trigger the improvement , no effect with origin api.

engin.runAsync(...) //ios
engine.asyncInit(...) //android

BM_ShellInitialization ≈ BM_ShellInitializationAsyncTotalTime = BM_ShellInitializationAsyncLockTime + asyncTime

story

When using in an add2app scenario where flutter page will not be triggered until some user operations. Reduce time of app startUp, make homepage display as soon as possible

  • before
    • click app icon -> mainthread locked by flutter entill init end (BM_ShellInitialization time )
    • show homepage (show slowly, the display time is delayed )
    • open second page(flutter or native or web)
  • after
    • click app icon -> no lock wait,reduce much time when app startup (BM_ShellInitializationAsyncLockTime, other work with async mode asyncTime)
    • show homepage (show quickly. The display time is unchange)
    • open second page(flutter or native or web)

complex_layout__start_up PR

Will create another pr of asyncstartup benchmarks like complex_layout__start_up after the next few days。 But it dependens modify of this pr ...

Copy link
Contributor

@liyuqian liyuqian left a comment

Choose a reason for hiding this comment

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

Thank you @lucky-chen for the clarification!

Since this is specific to add-to-app, let's loop @gaaclarke into the code review as he used to work on add-to-app, and landed a similar PR that parallelize the engine initialization (#10182).

if (asyncInitCallback == null) {
Log.w(
TAG,
"initAsync: callback is null, you should care lifecycle, and called other api after initCallback called");
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the following warning is a better translation: "initAsync: asyncInitCallback is null. Please be careful about the lifecycle and when the initialization is done. We recommend to set an asyncInitCallback, and call other APIs after such callback is executed."

@liyuqian liyuqian requested a review from gaaclarke April 9, 2020 19:44
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

I think this PR is perilous as-is because when creating the shell asynchronously there are no guarantees that the shell wont' be used anyway.

I think you what you've done here is good but could be better if we changed it a bit. Instead of creating 2 separate ways to make a shell, make creation always async and instead of relying on a callback to notify people when it's done, use a std::future. That way we can guarantee that the shell exists before it is used, no one can get it wrong.

@@ -166,6 +168,13 @@ class Shell final : public PlatformView::Delegate,
CreateCallback<PlatformView> on_create_platform_view,
CreateCallback<Rasterizer> on_create_rasterizer);

static void CreateAsync(ShellCreateCallback callBack,
Copy link
Member

Choose a reason for hiding this comment

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

Needs a docstring. Please include the threads that will be invoking each callback.

init(empty);
}

void AndroidShellHolder::init(AsyncInitCallback holderCallback) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we come up with a better name than holderCallback?

);

if (holderCallback) {
Shell::CreateAsync(
Copy link
Member

Choose a reason for hiding this comment

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

What ensures that shell_ is set before someone calls AndroidShellHolder::Launch?

@@ -24,6 +24,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
extern NSString* const FlutterDefaultDartEntrypoint;

/**
* the callback of engine async init mode
Copy link
Member

Choose a reason for hiding this comment

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

Full sentence documentation with proper punctuation please.

/**
* the callback of engine async init mode
*/
typedef void (^InitCallBackBlock)(bool);
Copy link
Member

Choose a reason for hiding this comment

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

/s/CallBack/Callback

@@ -128,6 +133,10 @@ FLUTTER_EXPORT
*/
- (BOOL)run;

/** like run() method, but this method not block mainThread when init
Copy link
Member

Choose a reason for hiding this comment

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

Proper punctuation with complete English, please.

- (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI {
- (BOOL)createShell:(NSString*)entrypoint
libraryURI:(NSString*)libraryURI
asyncInitCallback:(InitCallBackBlock)oc_async_init_block {
Copy link
Member

Choose a reason for hiding this comment

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

No abbreviations please.

FML_LOG(ERROR) << "Could not start a shell FlutterEngine on asyncInitMode";
oc_async_init_block(false);
} else {
selfRef->_shell = std::move(shell);
Copy link
Member

Choose a reason for hiding this comment

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

What's to stop someone from invoking sendOnChannel:message: before _shell is set? How would they even know when it was safe to call it?

null);
}

public FlutterEngine() {}
Copy link
Member

Choose a reason for hiding this comment

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

This is dangerous since it bifurcates the meaning of having a constructed engine. Rather, create an asynchronous factory that calls back with a FlutterEngine instance when it's ready.

Generally, prefer composition over adding more functionalities and state to a single class.

flutterLoader.startInitialization(context.getApplicationContext());
flutterLoader.ensureInitializationComplete(context, dartVmArgs);

flutterJNI.addEngineLifecycleListener(engineLifecycleListener);
attachToJni();
if (asyncInitListener != null) {
Copy link
Member

Choose a reason for hiding this comment

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

Since this is all about doing FlutterJNI.attachToNative() concurrently, you can just call that directly and not mix it into the state of the FlutterEngine instance. Do it outside this class.

/** like run() method, but this method not block mainThread when init
* @param block callbackBlock, called when async init end. must not be nil!
*/
- (void)asyncRun:(InitCallBackBlock)block;
Copy link
Member

Choose a reason for hiding this comment

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

Since you're adding an entirely new API, again for the sake of composable API and not mixing concepts together, you can actually just create a prepareVmAsync method or some such which gives you a callback when the Shell is created, at which point you can run run yourself.

Then we don't have to multiplex all the variants of run with an async variant.

@lucky-chen
Copy link
Author

lucky-chen commented Apr 26, 2020

@liyuqian need help : build host_release/profile failed after update repo (Android/iOS build success)

ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64

Durning february, all of type build success. But seems to start from the march, after update repo, host always build failed

detail errormsg

$ ninja -C out/host_release -j 6
ninja: Entering directory `out/host_release'
[2262/3207] ACTION //third_party/dart/runtime:generate_version_cc_file(//build/toolchain/mac:clang_x64)
Warning: Could not get the most recent dev branch tag fatal: unknown refname: format lstrip=2

[2778/3207] LINK ./fml_benchmarks
FAILED: fml_benchmarks 
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./fml_benchmarks -Wl,-filelist,./fml_benchmarks.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[2780/3207] LINK ./fml_unittests
FAILED: fml_unittests 
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./fml_unittests -Wl,-filelist,./fml_unittests.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
^Cninja: build stopped: interrupted by user.

Env

  • commit_id/engine_version: 4c8c31f
  • flutter doctor:
[✓] Flutter (Channel beta, v1.17.0-3.2.pre, on Mac OS X 10.15.3 19D76, locale zh-Hans-CN)
    • Flutter version 1.17.0-3.2.pre at /Users/chenpeihan/Library/flutter/flutter
    • Framework revision 2a7bc389f2 (4 days ago), 2020-04-21 20:34:20 -0700
    • Engine revision 4c8c31f591
    • Dart version 2.8.0 (build 2.8.0-dev.20.10)

[!] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    ! CocoaPods 1.7.5.3 out of date (1.8.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade:
        sudo gem install cocoapods

Step

  • new dir
  • gclient sync
  • cd src/flutter -> checkout master
  • git reset --hard 4c8c31f
  • gclient sync
  • ./flutter/tools/gn --runtime-mode release
  • ninja -C out/host_release -j 6

@liyuqian
Copy link
Contributor

@lucky-chen : try ./flutter/tools/gn --runtime-mode release --no-lto. The --no-lto should only increase the binary size without impacting other performances. Meanwhile, --no-lto significantly reduces the compile time so I always used it in local development 😄

@xster
Copy link
Member

xster commented Apr 27, 2020

You can also add your name to the AUTHORS file when you're ready for another look.

@lucky-chen
Copy link
Author

hi, all. I split these changes into 3 PR. This way may be better to review and merge。

after #18047 merged , i will submit the remaining 2 pr(Android/iOS)

@chinmaygarde shell.h/.cc modified according to your suggestion, look at #18047

bool CreateShell(std::function<std::unique_ptr()> shell_callback, … other arguments). When updating the iOS and Android embeddings, you can wait for the entire shell reference in the callback. This should not be an issue as it was not safe to use the shell reference before the callback anyway.

@liyuqian
Copy link
Contributor

liyuqian commented Jun 1, 2020

Shall we now close this in favor of #18047 ? (I understand that this PR includes more changes that will be submitted as follow-up PRs after the landing of #18047.)

@lucky-chen lucky-chen closed this Jun 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects: engine cla: yes customer: alibaba perf: speed Performance issues related to (mostly rendering) speed severe: performance Relates to speed or footprint issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants