CodeEditApp / CodeEditSourceEditor

A code editor view written in Swift powered by tree-sitter.
https://codeeditapp.github.io/CodeEditSourceEditor/documentation/codeeditsourceeditor
MIT License
510 stars 78 forks source link

🐞 `HighlightRange` memory efficiency #133

Closed thecoolwinter closed 1 year ago

thecoolwinter commented 1 year ago

HighlightRange takes up 48 bytes in memory. It should be replaced by something that is more memory efficient as we make a lot of those objects while highlighting.

thecoolwinter commented 1 year ago

This may have been a red herring from Instruments. When inspecting using MemoryLayout.size(ofValue: HighlightRange(...)) it returns 17 bytes consistently, which is a lot less than the 48 Instruments shows. This could be improved further but these only get allocated a lot on very large documents.