I'm aware of the fact that there shouldn't be runtime performance differences when moving methods of a class to extensions (as answered in Swift extension and are extensions bad for performance in swift?).
But I can not find much documentation about if there is any difference in runtime performance by changing the necessary private properties to fileprivate, which is generally needed in order to allow the methods (moved to an extension in the same file as the class), to access them.
Is anyone aware of any performance difference? (I don't care about compile time differences, which I think do not exist in this case anyway, just runtime.)
Why would there be such a difference? These privacy terms are mostly just notes to the compiler to forbid certain kinds of access.
The important gains at runtime come from using Whole Module Optimization and/or declaring your classes final. This allows dynamic dispatch to be switched off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With