[SR-11158] Re-specialize interpolation segment invocations on String after specializing #53555
Labels
compiler
The Swift compiler in itself
performance
SILOptimizer
Area → compiler: SIL optimization passes
task
Additional Detail from JIRA
md5: ff5022700bfbd3677810f44a7efffaae
Issue Description:
In https://forums.swift.org/t/performance-overhead-for-protocols/27104/6, a generic function is slower after generic specialization than the equivalent concrete function, because the generic function still uses the fully dynamic string interpolation entry point instead of one of the specific entry points. In a reduced example:
bar
uses theappendInterpolation<T: TextOutputStreamable>
implementation, andfoo
uses the fully generic implementation, even if we later specializefoo
forT == Double
. Since we know the behavior of the fully genericappendInterpolation
implementation, we could conceivably re-specialize calls into it if we later specialize a call to a type that we know statically conforms to one of the customization protocols.The text was updated successfully, but these errors were encountered: