Two pull requests I sent to Streamdown, Vercel's component for showing streaming AI answers: a link fix and a speed-up.

Speed-up

Repair only the end of the message

BeforeEvery update repairs the whole message.
AfterOnly the last two blocks are repaired.
Repaired before Repaired after Kept Stable length
Before0
After0

Characters repaired in a 20,000-token answer

Main-thread time, Chrome on an Apple M1

SpeedAnswerBeforeAfterChange
200 tokens/sMixed16.4 s15.1 s−7.9%
200 tokens/sCode-heavy14.5 s14.7 snoise
200 tokens/sTable-heavy20.7 s20.2 snoise
1,000 tokens/sMixed7.0 s6.4 s−8.4%
1,000 tokens/sCode-heavy6.7 s5.9 s−11.4%
1,000 tokens/sTable-heavy10.6 s10.7 snoise

Time per update

BeforeAfter

The stable length moves only when remend changed nothing

Added by remend Left: from the model · Right: repaired