1. 29
  1. 5

    The best general advice I can give is just this: make sure performance is part of the foundation of your app.

    The line between this and premature optimization isn’t clearly defined. Perhaps this isn’t in the scope of the article, but in general, I’ve noticed that many developers tend to fall into one of two camps: “pervasive optimization is necessary for performance”, and “premature optimization is the root of all evil”. Those in the former camp don’t often explain how they avoid premature optimization or spending time optimizing things that end up having a tiny impact on the performance of the system due to Amdahl’s Law.

    I suspect that only some architectural decisions made in NetNewsWire (and most applications) actually are significant with respect to app performance, and that the rest are incidental or so low-impact as to be irrelevant. I also suspect that determining which of those architectural decisions are important before you make them is an extremely difficult, if not intractable problem.

    1. 10

      The difference between premature optimization and pervasive optimization is domain knowledge. I’m working on a team finishing up a from-scratch rewrite of a very big website. Performance was a founding principle of the project and we nailed it. To a person who doesn’t understand the systems we are dealing with inside-out, the constraints of our specific project, what our user base looks like, exactly why our existing website had hit a local maxima in performance, why prior attempts at rewrites had failed the performance metric, etc it might seem like we were making all the wrong decisions to improve performance (e.g. moving from server rendering to client-side JS rendering). That person would be worried about a set of things they perceive to be important but in reality aren’t, because they have no way of knowing what is important. Premature optimization is just optimizing before you know what is important and getting that wrong. Pervasive optimization from the start requires knowing exactly what is important.

      The takeaway is that given a sufficiently complex project you can’t choose to worry about optimization up front and NOT prematurely optimize the wrong things. It’s not a philosophical stance you can take. You have to start by trying to optimize things and fucking everything up over and over again until you become an expert at knowing what is actually important, and then you can do it right the next time you tackle the same problem.

    2. 3

      Tag suggestion: Swift. NetNewsWire is almost 100 % Swift.

      1. 5

        I’m interested to learn that. It’s much older than swift so it must have been rewritten at some point recently. Therefore it being written in Swift is not a core part of its “identity”. swift is not mentioned in the article at all and none of the matters discussed are specific to swift (or even areas where swift is pertinent)

        For these reasons I don’t think the swift tag is relevant.

        1. 4

          I also consider the swift tag irrelevant. Seeing as the tags here are purely used to allow users to hide posts (and to lower some in the algorithm), adding a tag purely due to a loose relation to the article seems like a bad idea. Less tags are better. If I hadn’t just installed a new browser and not yet logged in, I wouldn’t have seen the article which would have been a shame since I found it an interesting read.

          I suggested the performance tag. I was also considering the databases tag but didn’t go for it in the end.

          1. 1

            Yes, my suggestion was in opposition to the ObjC tag, since that was misleading.

        2. 1

          Hejsan! Thanks, I didn’t realize that.

        3. 2

          The best general advice I can give is just this: make sure performance is part of the foundation of your app. Make sure it‘s part of every decision every day.

          Make sure, in other words, that performance isn’t just a topping — it’s the pizza.

          I think this is an interesting way to put it. Performance is a “core principal” of NetNewsWire. What other things might be core values of a software project? Some I can think of:

          • Feature-completeness
          • UX
          • Security
          • Testability
          • Good developer experience

          Then there are some other more ‘questionable’ values I’ve seen

          • Defects are hidden from users, blame users
          • Tricks users into spending money/making mistakes
          1. 1

            I thought of a few more

            • Metrics (performance)
            • Analytics (usage)
            • Tracability (are there logs for when something goes wrong?)
            1. 2
              • Accessibility
              • Composability(heavily related to a couple of others)
              1. 2

                These map onto software architecture “quality attributes” which are discussed in detail in the SEI book Software Architecture in Practice. The ones in the book are:

                • Availability
                • Interoperability
                • Modifiability
                • Performance
                • Security
                • Testability
                • Usability

                Of course certain domains or projects will have different quality attributes than these, but these ones are fairly universal so they get discussed in detail in architecture.

                Part of the purpose of software architecture is to get people thinking about these quality attributes and prioritizing them early in the design process because there are usually tradeoffs between them (e.g. performance often comes at a cost of modifiability) and architecture is to some extent about making sure that everyone is on the same page about what the priorities are, so the decisions don’t get made on-the-fly by developers based on their own preferences.