use immutable buffer for loading asset images#103496
use immutable buffer for loading asset images#103496fluttergithubbot merged 29 commits intoflutter:masterfrom
Conversation
| uses-material-design: true | ||
| assets: | ||
| - icon/ | ||
| - icon/test.png |
There was a problem hiding this comment.
This was indented wrong and never loaded the asset
There was a problem hiding this comment.
Why didn't the associated test above fail, then? It seems to claim that it tests whether the asset loads....
There was a problem hiding this comment.
The previously used asset loader workaround does not throw errors in the same way as the regular asset loader: https://github.com/flutter/flutter/blob/master/packages/flutter_test/lib/src/_binding_io.dart#L34
…er into use_immutable_buffer
|
TBD whether or not we should leave the old methods implemented. I intended to do further testing to see if there are any places in google that uses the load method directly |
|
SkiaPerf microbenchmark results look good: https://flutter-flutter-perf.skia.org/e/?begin=1651498148&end=1654001288&keys=Xffbf390d4558490c4e2bc4416f712061&requestType=0&xbaroffset=29184 |
Loading asset images via the immutable buffer should both improve loading performance by removing a copy and reduce GC pressure by avoiding a round-trip of the compressed image bytes through the dart heap.
This is the start of a breaking change, this PR is intended to be non-breaking (though it currently isn't, for testing purposes)
To make this change less-breaking, a default implementation of the loadBuffer is added to imageProvider, that returns a const instance of a no-op image stream. We detect this case and fallback to the old load method conditionally, allowing image providers time to migrate.