From 90d60fc73bbb1ea11fd1a7179446d6cc70a591d2 Mon Sep 17 00:00:00 2001 From: George Wright Date: Wed, 23 Feb 2022 10:48:05 -0800 Subject: [PATCH] Tweak saveLayer complexity scoring on Metal (flutter/engine#31616) --- .../display_list_complexity_metal.cc | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/engine/src/flutter/display_list/display_list_complexity_metal.cc b/engine/src/flutter/display_list/display_list_complexity_metal.cc index ed1a48cd2f..6d4983f06b 100644 --- a/engine/src/flutter/display_list/display_list_complexity_metal.cc +++ b/engine/src/flutter/display_list/display_list_complexity_metal.cc @@ -35,15 +35,19 @@ DisplayListMetalComplexityCalculator::MetalHelper::BatchedComplexity() { // saveLayer seems to have two trends; if the count is < 200, // then the individual cost of a saveLayer is higher than if // the count is > 200. - if (save_layer_count_ > 200) { - // m = 1/5 - // c = 1 - save_layer_complexity = (save_layer_count_ + 5) * 40000; - } else { - // m = 1/2 - // c = 1 - save_layer_complexity = (save_layer_count_ + 2) * 100000; - } + // + // However, the trend is strange and we should gather more data to + // get a better idea of how to represent the trend. That being said, it's + // very unlikely we'll ever hit a DisplayList with 200+ saveLayer calls + // in it, so we will calculate based on the more reasonably anticipated + // range of less than 200, with the trend line more weighted towards the + // lower end of that range (as the data itself doesn't present as a straight + // line). Further, we will easily hit our cache thresholds with such a + // large number of saveLayer calls. + // + // m = 1/2 + // c = 1 + save_layer_complexity = (save_layer_count_ + 2) * 100000; } unsigned int draw_text_blob_complexity;