Open rnystrom opened 6 years ago
Yeah, big fan of CATiledLayer for huge chunks of text. However, they are REALLY heavy weight on memory and bad for scroll perf if you have a bunch of them on the screen at once (I tested this awhile ago). In my other text impl I worked on in 2015 in my spare time I came up with the idea of a dual CALayer/CATiledLayer impl that basically uses the layers as stupid shells, and encapsulates logic in a layer render delegate. It's a kind of complicated dance that I'm sure could be simplified.
I pulled the impl from my old project:
https://gist.github.com/ocrickard/9892a28cfd733a84fed95b2a66f27615
Anyway, if you're looking for inspiration, that impl performs great both in tiny little labels, and in huuuge walls of text.
TIL!!
I've never used it before, spared me a lot of time figuring this out lol. I bet the async drawing will be a good quick win. Then if we (or someone else) is hitting huge perf issues from drawing giant bitmaps, then we can find a way to make this work.
Idk how best to combine these, but would improve rendering huge chunks of text.
mmap
bitmap from disk