8 ms·
Yes. NSTextStorage can also contain the same attributes as the temporary attributes (rendering attributes in TextKit 2). The benefit of using temporary attribu
by papereditor 3y ago
Yes. NSTextStorage can also contain the same attributes as the temporary attributes (rendering attributes in TextKit 2).
The benefit of using temporary attributes is that changing them is very fast compared to invoking the full transaction on NSTextStorage. For example, switching between Light/Dark modes is very fast in Paper.
- lilyball 3y agoI would have expected a transaction to track whether any changes affect layout and avoid invalidating layout if only changing rendering attributes. I assume you've actually measured this though, and so I have to infer that this optimization does not in fact happen.
- papereditor 3y agoThings might have changed already, but yes, when I measured it there was a noticeable difference. Ideally, I would have expected it to behave like you have described.