Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.84 KB

File metadata and controls

59 lines (40 loc) · 1.84 KB

AutoResearch: Flutter App Startup Time

Objective

Minimize cold-start time for the Flutter app on Android emulator.

Target metric: startup_ms (lower is better) Run command: flutter test integration_test/startup_bench.dart --plain-name "startup" 2>&1 | grep "startup_ms" Time budget: 3 minutes per experiment

Editable Files

Only these files may be modified during experiments:

  • lib/main.dart — App entry point, initialization sequence, provider setup
  • lib/app.dart — Root widget, route configuration, theme setup
  • lib/di/injection.dart — Dependency injection setup, service registration order

Locked Files (Do NOT Modify)

  • integration_test/ — Benchmark harness
  • pubspec.yaml — Dependencies are locked
  • lib/models/ — Data models
  • lib/services/ — Service layer (only DI registration order can change)

Evaluation

After each run, determine success by:

  1. The integration test prints startup_ms: N to stdout
  2. Extract N as the target metric
  3. Run 3 times and take the median to reduce variance

Minimum improvement threshold: 20ms Simplicity rule: A 10ms improvement that makes the code unreadable is NOT worth it.

Constraints

  • Do NOT add or remove packages
  • Do NOT change the app's functionality
  • All screens must still be reachable
  • State management pattern must stay the same

Strategy

What to Try (in rough priority order)

  1. Defer heavy service initialization (lazy singletons)
  2. Reduce widget tree depth in initial route
  3. Lazy-load routes that aren't shown on startup
  4. Move image precaching to post-first-frame callback
  5. Reduce number of ChangeNotifier rebuilds during init
  6. Use const constructors where possible

What to Avoid

  • Removing features to speed up startup
  • Switching state management library
  • Platform-specific native code changes