[mobile][photos] Reduce GC events when loading models (#1223)

## Description

When using `readAsBytes()`, noticed a lot of `concurrentMark` GC event
in timeline when using the performance profiler dev tool, which were
potentially causing longer build and raster time for frames.
This commit is contained in:
Vishnu Mohandas 2024-03-27 16:44:05 +05:30 committed by GitHub
commit be62ea1459
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -15,9 +15,10 @@ class OnnxImageEncoder {
..setIntraOpNumThreads(1)
..setSessionGraphOptimizationLevel(GraphOptimizationLevel.ortEnableAll);
try {
final bytes = await File(args["imageModelPath"]).readAsBytes();
final session = OrtSession.fromBuffer(bytes, sessionOptions);
final session =
OrtSession.fromFile(File(args["imageModelPath"]), sessionOptions);
_logger.info('image model loaded');
return session.address;
} catch (e, s) {
_logger.severe(e, s);

View file

@ -12,7 +12,7 @@ description: ente photos application
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.8.71+591
version: 0.8.72+592
publish_to: none
environment: