Repository navigation
forme 0.7.1
Shaping a run no longer allocates for its working memory: from #907, filed against 0.7.0, whose cluster merging and AAT positioning added one or two allocations to every run.
A run's working memory is the face's (#907, #908)
- What a run is shaped in and is done with before it is returned is kept on the face and reused by the next run: its characters and offsets, the normalised text, the grapheme continuation and drop flags, the positioning record and attachment sums, the buffer the substitutions edit the run in (which was a new one per lookup), and the run's counters. A clone does not share it.
- A multiple substitution reads its glyphs from the font rather than copying them, and a string with nothing right-to-left in it skips the bidi run listing.
- A face's scratch is as large as the longest run it has shaped, about 10 bytes a glyph, for as long as the face is kept.
ShapeGlyphs on a warm face:
| 0.6.0 | 0.7.0 | 0.7.1 | |
|---|---|---|---|
| short labels | 8.0 µs, 19 allocs | 7.2 µs, 21 | 6.5 µs, 1 |
| 120-char sentence | 81 µs, 21 | 84 µs, 24 | 77 µs, 1 |
| combining marks | 11 µs, 22 | 11.9 µs, 24 | 10.8 µs, 1 |
| Arabic | 31 µs, 71 | 39.6 µs, 73 | 29.4 µs, 12 |
The one allocation left is the glyphs returned. Shaping output is unchanged.
bidi
RunCharactersIntoisRunCharacterswriting into arrays the caller keeps.- The algorithm's isolating run sequences are built with arrays indexed by position rather than maps. Unicode's conformance suites pass in full.