Does adding `final`, `private` keyword improve compile time?

According to this blog post: https://developer.apple.com/swift/blog/?id=27
Adding final, private keywords in Swift improves "runtime" performance by reducing dynamic dispatches, and I'm just wondering if adding those keywords could also improve compile time?

Maybe the compiler could do less work on determining which method should use dynamic / static dispatch?
Tried to figure out but I have no idea of how to verify my thoughts

Thank you!

I would be very surprised if either access control or final made a difference in compile time.

1 Like

Basically what Slava said. Personally I just use final if I want to restrict subclassing and I don’t think too much about any performance implications of it.

I would be interested to see any benchmarks if you have one!

Terms of Service

Privacy Policy

Cookie Policy