WKWebView Rendering Latency in 10.14.4
I noticed, starting in MacOS 10.14.4, that switching between articles in NetNewsWire was way less smooth than it had been.
NetNewsWire uses a WKWebView to display HTML. Before 10.14.4, there was no perceptible delay when switching to a new article.
With 10.14.4, there is. It’s quite noticeable, enough to be unacceptable.
I did some more detective work, and I’ve narrowed down the problem a little bit.
loadHTMLString(String, baseURL: URL?). The HTML is generated locally, and I set the
baseURL because I want relative paths (especially for images) to get resolved properly.
What I found:
- If I make
baseURLnil, then the latency is gone.
baseURLis the same as in the previously-loaded article, then the latency is gone.
Here’s what I’m exploring: instead of using
loadHTMLString for each article, I will:
loadHTMLStringwith a nil
baseURLexactly once, to load a template.
- To make relative paths resolve, I’ll parse and rewrite article HTML with resolved relative paths.
This is not work I was planning, and it means taking a break from syncing to get this done — because, right now, with 10.14.4, the app is not nearly as nice to use as it was.
PS While I’m rewriting the HTML, I’ll also remove