Post #1758316
2026-04-20 14:24 UTC
@teilweise @Sarnau @mayo @dasdom
Try making action and reason constants and make sure you have optimization turned on (may need debug build turned off and strip the binaries as well).
This is so simple an optimization that even a 25 year old compiler should be able to do it. It will take more than words to convince me that Apple are that bad at writing compilers.
Replies (1)
-
@teilweise@layer8.space 2026-04-20 14:46
@leeloo @Sarnau @mayo @dasdom ``` import Foundation print("Cannot \("action") because \("reason")") ``` gets optimized when compiled with `swiftc -O` as you assumed. BUT ``` import Foundation let action = "action" let reason = "reason" print("Cannot \(action) because \(reason)") ``` is not optimized to "Cannot action because reason". For localized strings, it *cannot* be optimized, the key format is documented, it will be “Cannot %@ because %@”.