-
Notifications
You must be signed in to change notification settings - Fork 175
Performance improvements #308
Copy link
Copy link
Open
Description
Areas for perf improvement:
-
Buffer::set_textcan be optimized in a similar fashion to Big optimizations for Buffer::set_rich_text #303. - Use
SmallVecinstead ofVecwhere it makes sense. This should somewhat reduce the cost to make new buffers. - There are two allocations at the top of
set_rich_textthat can be moved toShapeBuffer. - Internally,
ShapeLineis essentially aVec<Vec<Vec<ShapeGlyph>>>. This can be flattened into two vecs: a vec of indices + metadata and a vec of ShapeGlyphs. Or even one vec with the metadata in-line.- I attempted this but got stuck on the need to sometimes reverse words and glyphs in
ShapeSpan. It may be less efficient to reverse elements of a flattened vec than the current implementation.
- I attempted this but got stuck on the need to sometimes reverse words and glyphs in
- Internally,
BufferLinecaches aVec<LayoutLine>, which is essentiallyVec<Vec<LayoutGlyph>>. This could also be flattened.- The challenge here is needing/using
[LayoutGlyph]in the layout iterator. We would no longer have access to a raw slice of glyphs.
- The challenge here is needing/using
-
Buffercaches aShapeBufferbut it would be better to have this inFontSystemor elsewhere for global reuse. -
FontFallbackIter::monospace_fallbackscan be injected or reused fromFontSystem -
shape_fallback()returns aVecthat isn’t reused, and takes aVecof glyphs. These can be moved toShapeBuffer. -
ShapeLine::adjust_levelsproduces aVecthat can be cached. -
ShapeLine::buildmakes a newunicode_bidi::BidiInfoevery time, which contains multiple allocations.- Sadly,
unicode-bidiis not designed to let you reuse allocations.wizterm-bidilooks like it might be more performant, but the API is more restricted and I got stuck trying to test it out (it also doesn't supportno-std).
- Sadly,
-
ShapeLine::reorderallocates twice internally. -
BidiParagraphsmakes a newunicode_bidi::BidiInfowhen constructed, which allocates multiple times. -
ShapeLineKeyuses allocations that could be cached. It's also pretty expensive to hash.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels