From 2f2dc81599852686d699eab08f06db5276645d58 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Mon, 1 May 2023 15:07:06 -0700 Subject: [PATCH] Run flutter license script with dart `--intrepret_irregexp` runtime option (flutter/engine#41646) For extremely large RegExp's that are used in flutter license script, running interpreter-based implementation is faster than running generated unoptimized code. For normal-sized RegExp's optimized code is expected to be faster. Local testing shows 5x speed up on full license script run (311s vs 1430s). Should help with https://github.com/flutter/flutter/issues/118193 --- engine/src/flutter/ci/licenses.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/ci/licenses.sh b/engine/src/flutter/ci/licenses.sh index 448013a7b0..8d6e2c6093 100755 --- a/engine/src/flutter/ci/licenses.sh +++ b/engine/src/flutter/ci/licenses.sh @@ -72,10 +72,15 @@ function run_tests() ( # Runs in a subshell. function collect_licenses() ( cd "$SRC_DIR/flutter/tools/licenses" - dart --enable-asserts lib/main.dart \ - --src ../../.. \ - --out ../../../out/license_script_output \ - --golden ../../ci/licenses_golden \ + # `--interpret_irregexp`` tells dart to use interpreter mode for running + # the regexp matching, rather than generating machine code for it. + # For very large RegExps that are currently used in license script using + # interpreter is faster than using unoptimized machine code, which has + # no chance of being optimized(due to its size). + dart --enable-asserts --interpret_irregexp lib/main.dart \ + --src ../../.. \ + --out ../../../out/license_script_output \ + --golden ../../ci/licenses_golden \ "${QUIET}" )