[InterfaceFile] Improve flag extraction from interface file

Improve the version/flags extract from interface file by moving away
from using Regex and limiting the search to the beginning of the file.

Switch away from Regex will give 5-10% improvement in time and
instruction counts, and limiting the search lines can save a lot of time
if the swiftinterface is large. For example, the extract time for Swift
stdlib is 10x faster after the patch.

Current strategey for limiting the line to search is by only parsing the
first comment block.
This commit is contained in:
Steven Wu
2024-03-05 11:17:58 -08:00
parent 56ec62570f
commit 8150fb001d
5 changed files with 34 additions and 24 deletions

View File

@@ -22,6 +22,8 @@
#define SWIFT_COMPILER_VERSION_KEY "swift-compiler-version"
#define SWIFT_MODULE_FLAGS_KEY "swift-module-flags"
#define SWIFT_MODULE_FLAGS_IGNORABLE_KEY "swift-module-flags-ignorable"
#define SWIFT_MODULE_FLAGS_IGNORABLE_PRIVATE_KEY \
"swift-module-flags-ignorable-private"
namespace swift {