How to speed-up initial UI rendering faster in AppKit?

I am developing an AppKit application in MacOS with Swift.

Our application requires a complex, multi-windowed interface and must deliver a very fast, responsive experience.

As a performance test, I built a sample app that creates 3 windows programmatically, each containing 500 NSTextFields (with each text-field assigned 35 different properties).

Code flow: https://gist.github.com/Raunit-TW/5ac58ac9c6584f93e2ee201aa8118139

This takes around 77 milliseconds to render the windows - I need to find a way to reduce this time, as low as possible.

Thanks.

It should like you should be building a table view instead. A table view optimizes this by reusing a single NSTextField. After all, a user can only interact with a single text field at a time.

I’ve used NSTextField as an example, but in reality, there will be various types of UI elements, such as buttons, dropdowns, tables, and more. All these elements must be visible on the screen all at once.

It's the same thing. A table view reuses all cell views.

It simply takes some time to draw these user interface elements. You have to leverage the tools you have and the material conditions of the user interface. Chances are, the window is going to be too small to show all those views. So you only show what fits on the screen. Table views and collection views are optimized to do this.

Then, when the user wants to see more, they can scroll. Any newly revealed portion of the view is going to have less content than the full thing, so this newly revealed content can be drawn in real time. If you're really living on the edge, there are even ways to cache overflows that that scrolling is smoother.

How to speed-up initial UI rendering faster in AppKit?
 
 
Q