Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-11158] Re-specialize interpolation segment invocations on String after specializing #53555

Open
jckarter opened this issue Jul 19, 2019 · 1 comment
Labels
compiler The Swift compiler in itself performance SILOptimizer Area → compiler: SIL optimization passes task

Comments

@jckarter
Copy link
Member

Previous ID SR-11158
Radar rdar://problem/53285593
Original Reporter @jckarter
Type Task
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Task, Optimizer, Performance
Assignee None
Priority Medium

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:

func foo<T: FloatingPoint>(x: T) -> String { return "\(x)" }
func bar(x: Double) -> String { return "\(x)" }

bar uses the appendInterpolation<T: TextOutputStreamable> implementation, and foo uses the fully generic implementation, even if we later specialize foo for T == Double. Since we know the behavior of the fully generic appendInterpolation 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.

@jckarter
Copy link
Member Author

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added SILOptimizer Area → compiler: SIL optimization passes and removed Optimizer labels Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself performance SILOptimizer Area → compiler: SIL optimization passes task
Projects
None yet
Development

No branches or pull requests

2 participants