Skip to content

Optimise Container(color: ...) #9672

Closed

Description

@Hixie

Based on my experience porting app code after #9648, it seems to be very common to have a Container with just a color. Right now we do a lot of work to handle that case. It seems like we could special-case that particular case to be much more efficient.

Activity

  1. added
    c: performanceRelates to speed or footprint issues (see "perf:" labels)
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Apr 28, 2017
  2. added this to the milestone on Apr 28, 2017
  3. HansMuller commented on Apr 28, 2017

    @HansMuller
    Contributor

    Or a BackgroundColor widget?

  4. Hixie commented on Apr 28, 2017

    @Hixie
    ContributorAuthor

    I meant a Container with a decoration that's just a color. The Container itself typically has other properties like width/height. But yeah, Container could use a widget like "ColoredBox" or something to handle this case.

  5. HansMuller commented on Apr 28, 2017

    @HansMuller
    Contributor

    Similarly, if I just want to add a background color, I could use ColoredBox(color: color, child: ...), instead of Container.

  6. liyuqian commented on Oct 7, 2019

    @liyuqian
    Contributor

    Is this still an active issue? Do we have a benchmark or metric that tracks this? @Hixie @HansMuller

  7. Hixie commented on Oct 7, 2019

    @Hixie
    ContributorAuthor

    Nothing has changed in this area since I filed it. We don't have any benchmarks for specifically this case though I wouldn't be surprised if several of our benchmarks do exercise the relevant code.

  8. modified the milestones: , on Oct 7, 2019
  9. dnfield commented on Feb 18, 2020

    @dnfield
    Contributor

    I had started this at one point and got caught up in trying to make it do more than it probably should (e.g. gradients).

    A quick run of complex layout scroll perf suggests that this makes the benchmark faster (that app uses some Container that have color specified).

    I'll put something up simple for this. If we want to support gradients it shouldn't be hard, or it shouldn't be too hard for someone else to just make a widget based on my simple one to do that.

  10. self-assigned this
    on Feb 18, 2020
  11. modified the milestones: , March 2020 on Feb 18, 2020
  12. added
    perf: speedPerformance issues related to (mostly rendering) speed
    on Feb 18, 2020
  13. github-actions commented on Aug 22, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  14. locked as resolved and limited conversation to collaborators on Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

c: performanceRelates to speed or footprint issues (see "perf:" labels)frameworkflutter/packages/flutter repository. See also f: labels.perf: speedPerformance issues related to (mostly rendering) speed

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions