Open
Description
Areas for perf improvement:
-
Buffer::set_text
can be optimized in a similar fashion to Big optimizations for Buffer::set_rich_text #303. - Use
SmallVec
instead ofVec
where it makes sense. This should somewhat reduce the cost to make new buffers. - There are two allocations at the top of
set_rich_text
that can be moved toShapeBuffer
. - Internally,
ShapeLine
is 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,
BufferLine
caches 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
-
Buffer
caches aShapeBuffer
but it would be better to have this inFontSystem
or elsewhere for global reuse. -
FontFallbackIter::monospace_fallbacks
can be injected or reused fromFontSystem
-
shape_fallback()
returns aVec
that isn’t reused, and takes aVec
of glyphs. These can be moved toShapeBuffer
. -
ShapeLine::adjust_levels
produces aVec
that can be cached. -
ShapeLine::build
makes a newunicode_bidi::BidiInfo
every time, which contains multiple allocations.- Sadly,
unicode-bidi
is not designed to let you reuse allocations.wizterm-bidi
looks 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::reorder
allocates twice internally. -
BidiParagraphs
makes a newunicode_bidi::BidiInfo
when constructed, which allocates multiple times. -
ShapeLineKey
uses allocations that could be cached. It's also pretty expensive to hash.
Metadata
Assignees
Labels
No labels