Do you need help on a specific subject? Use the contact form (Request a blog entry) on the right hand side.

2015-06-12

Final, Private and optimization

I just saw the WWDC video "Optimizing Swift Performance".

A very useful video for all software developers (that use Swift).

As a software engineer I create software solutions. In order to do that to my best ability, I have taken a liking to "Software Engineering" as a discipline. I.e. how to write good software. Using information hiding, decoupling etc, all these kind of things. Given this background I think I can be forgiven that I assumed that the "Final" and "Private" were in fact tools to help the software engineer.

Hmm, I could not have been more wrong.

After looking at the video, I think you will agree: "Final" and "Private" are meant to allow the compiler to optimize.

Sure they have some meaning for the engineer as well, but all in all? no they are optimizer switches!

Btw: I used "Final" on a class that is the basis of my recent app and that will not be subclassed. The speed improvement was substantial!

There is more in the video, but I for me will use "final" and "private" wherever I can...

Happy coding....

Did this help?, then please help out a small independent.
If you decide that you want to make a small donation, you can do so by clicking this
link: a cup of coffee ($2) or use the popup on the right hand side for different amounts.
Payments will be processed by PayPal, receiver will be sales at balancingrock dot nl
Bitcoins will be gladly accepted at: 1GacSREBxPy1yskLMc9de2nofNv2SNdwqH

We don't get the world we wish for... we get the world we pay for.

No comments:

Post a Comment