When implementing feature flags in a mobile application, performance is crucial. Feature flag evaluations happen frequently during your app’s lifecycle, and any latency in these evaluations can impact the user experience. This is especially important in Flutter applications, where smooth performance is a key selling point.
In this post, we’ll dive into the performance characteristics of the feature_flags_toggly
Flutter package, sharing detailed benchmark results and what they mean for your application.
We conducted extensive performance testing of our Flutter feature flags implementation using a real-world device: a 6th generation iPad Mini Cellular. The benchmarks focused on measuring feature flag evaluation times, which is the most frequent operation in a feature flag system.
Our benchmark suite includes:
The complete benchmark code is available on GitHub for transparency and reproducibility.
We ran two complete test cycles after our latest optimizations, and here are the detailed results:
Average: 156.41µs Median: 145µs P95: 257µs Min: 36µs Max: 1,173µs
Average: 89.42µs Median: 74µs P95: 188µs Min: 19µs Max: 307µs
Let’s break down what these results mean for your application:
Ultra-Fast Performance: Both test runs show exceptional performance, with the second run achieving remarkable sub-100µs average evaluation times. This is orders of magnitude faster than typical UI operations.
Remarkable Consistency: The median times (145µs and 74µs) are consistently lower than their averages, demonstrating extremely stable performance. The second run shows particularly tight performance characteristics with even less variance.
Exceptional Best Case: Minimum evaluation times as low as 19µs in the second run demonstrate the extreme efficiency of our local evaluation system after warm-up.
Reliable Worst Case: Even the maximum times (1,173µsµs and 307µs) are well under acceptable thresholds for mobile applications. The second run shows particularly tight bounds on maximum latency.
Tight Performance Bounds: The 95th percentile (P95) numbers of 257µs and 188µs show that the vast majority of evaluations complete in about a quarter of a millisecond, providing highly predictable performance for your application.
To ensure you get the best performance from feature flags in your Flutter application:
Use Local Evaluation: Our SDK performs all evaluations locally, eliminating network latency from the critical path.
Enable Caching: Feature flag definitions are cached locally, ensuring fast access even in offline scenarios.
Batch Updates: Flag definitions are updated in the background, without blocking flag evaluations.
Minimize Complex Rules: While our evaluation engine is highly optimized, simpler targeting rules evaluate faster.
Based on these benchmarks, the performance impact of using feature flags in your Flutter application is minimal:
Our Flutter SDK achieves these performance characteristics through several optimizations:
In-Memory Cache
Persistent Storage
Security Verification
void initToggly() async { await Toggly.init( appKey: '<your_app_key>', environment: '<your_app_environment>', // Default refresh interval is 3 minutes refreshInterval: Duration(minutes: 3), useSignedDefinitions: true, ); }
Our background update system includes several optimizations:
Efficient Network Usage
Non-Blocking Updates
The evaluation engine uses efficient data structures and algorithms:
Feature( featureKeys: const ['ExampleFeature'], // Evaluations happen synchronously from cache child: const Text('Fast feature evaluation'), )
Key optimizations include:
While we don’t publish direct comparisons with other feature flag providers, our benchmarks demonstrate that the feature_flags_toggly
package provides:
The benchmark results demonstrate that our Flutter feature flags implementation provides excellent performance characteristics suitable for production applications. With average evaluation times under 1ms and consistent performance across thousands of evaluations, you can confidently use feature flags without worrying about performance impact.
The combination of local evaluation, efficient caching, and background updates ensures that feature flags add minimal overhead to your Flutter application while providing powerful feature management capabilities.
For more details about the benchmarks or to run them yourself, check out our benchmark code on GitHub.
Legal Stuff