Skip to content

Enable hot restart on profile mode #37987

Open

Description

@liyuqian

Currently, performance debugging in profile mode is really time consuming because every small change requires a cold restart, which could take several minutes.

While hot reload is impossible in AOT profile build, hot restart should be possible according to @cbracken .

Let's enable it in flutter tools to significantly speedup our customers' performance debugging process.

Activity

  1. added
    c: new featureNothing broken; request for a new capability
    toolAffects the "flutter" command-line tool. See also t: labels.
    c: performanceRelates to speed or footprint issues (see "perf:" labels)
    on Aug 9, 2019
  2. liyuqian commented on Aug 9, 2019

    @liyuqian
    ContributorAuthor

    @jonahwilliams : how difficult do you think this is?

  3. jonahwilliams commented on Aug 9, 2019

    @jonahwilliams
    Contributor

    I think this would be at least several weeks of work, if only due to current structural issues with the resident runners. But there are a lot of unknowns too which could sink the whole thing.

    • I'm not certain if runFromSources works in profile mode, which would be a requirement for the "hot" part.
    • I'm not certain if any of the embedding know how to look in tmp/devfs for aot artifacts, or can handle changing them.
    • I'm not certain if this process can generalize across devices. For example, on iOS AOT builds provide an App.framework. I don't think we could change that.
  4. jonahwilliams commented on Aug 9, 2019

    @jonahwilliams
    Contributor

    So I would classify as "needs investigation"

  5. jonahwilliams commented on Aug 10, 2019

    @jonahwilliams
    Contributor

    Another caveat: We can only build the AOT artifacts in the runner using the "regular" workflow, I'm not sure if we know how to in google3. + @chingjun

  6. chingjun commented on Aug 10, 2019

    @chingjun
    Contributor

    "Regular" as in "not google3"? google3 doesn't support incremental builds for hot restart so we might need to fallback to the "regular" workflow anyway

    I'm also concerned about whether incremental builds are possible in AOT mode with tree-shaking or obfuscation enabled, and how much faster that is than a full rebuild.

  7. jonahwilliams commented on Aug 10, 2019

    @jonahwilliams
    Contributor

    I don't think they could be incremental. Any speed gain would need to come from skipping the platform build steps, such as APK/IPA packaging

  8. liyuqian commented on Aug 12, 2019

    @liyuqian
    ContributorAuthor

    I see that this is challenging and needs investigation. Thank you for looking into this! I'll keep this issue open as a wish item of performance debugging?

  9. added this to the milestone on Jan 28, 2020
  10. added
    P3Issues that are less important to the Flutter project
    on May 29, 2020
  11. fredlee12345678 commented on Jul 16, 2020

    @fredlee12345678
    Contributor

    @jonahwilliams do you plan to this issue? this is very useful feature for us, thanks

  12. jonahwilliams commented on Jul 16, 2020

    @jonahwilliams
    Contributor

    We have no plans to work on this in the immediate future

  13. 2 remaining items

  14. tjx666 commented on Mar 10, 2021

    @tjx666

    I think it's very meaningful. I want to profile a add-to-app in profile mode, but the code sync to mobile is old which need hot restart like in debug mode.

  15. fzyzcjy commented on Apr 5, 2021

    @fzyzcjy
    Contributor

    Hi, any updates? As we know, the startup time is important to user experience. Therefore, I want to know why my app needs several seconds to start - which parts need how much time, such that I can try to optimize the startup time.

    In order to profile the app and see detailed stack, I need to open the DevTools (you know, that web page). However, it takes seconds to initialize and open devtools. Unfortunately, when devtools is finally opened, the app startup has almost finished! So I cannot profile anything for the startup procedure... :(

  16. fzyzcjy commented on Jul 14, 2021

    @fzyzcjy
    Contributor

    3 months have passed... any updates?

  17. feinstein commented on Apr 20, 2022

    @feinstein
    Contributor

    Instead of having restart in profile mode, could we have the profile run wait for DevTools to be running to continue the app's execution?

    Maybe the Flutter tool could have a flag to generate the websocket URL during the build and pass this url to the app and DevTools, so DevTools would know beforehand what URL to listen.

    My problem is that I have a bit of jank in my app's startup, and just in some edge cases, but it's is extremely difficult to profile it, since DevTools would only start after the app is already running.

  18. abdalmonem commented on Jan 9, 2023

    @abdalmonem
    Contributor

    without hot restart profiling is too hard and time consumer , we keep waiting for this feature since 2019 ant till now there is no updates about :(

  19. bkonyi commented on Jun 30, 2025

    @bkonyi
    Contributor

    Profile mode is meant to build an application that mimics release mode performance as closely as possible while allowing for performance profiling. This means that profile mode applications are built using ahead of time compilation (AOT), which does not support hot reload. Adding hot reload support would be a major change to the Dart AOT runtime and would introduce overhead into a profile mode application that wouldn't be present in a release application, defeating the purpose of profile mode.

  20. feinstein commented on Jul 1, 2025

    @feinstein
    Contributor

    @bkonyi I think you misread the post, we are not asking for hot reload, we are asking for hot restart.

    The post even mentions what you said, that hot reload is not possible, but hot restart should be possible.

  21. bkonyi commented on Jul 2, 2025

    @bkonyi
    Contributor

    @bkonyi I think you misread the post, we are not asking for hot reload, we are asking for hot restart.

    The post even mentions what you said, that hot reload is not possible, but hot restart should be possible.

    You're totally right, I completely misread this. Thanks for letting me know!

    That being said, this likely won't be picked up any time soon.

  22. reopened this on Jul 2, 2025
  23. added
    tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.
    on Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: performanceRelates to speed or footprint issues (see "perf:" labels)customer: dream (g3)team-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool teamwould require significant investmentA PR would not be accepted without a plan for ongoing support

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions