Skip to content

Avoid allocating a Vec for every token during rendering#760

Merged
reese merged 1 commit intotrunkfrom
reese-vec-alloc
Jan 5, 2026
Merged

Avoid allocating a Vec for every token during rendering#760
reese merged 1 commit intotrunkfrom
reese-vec-alloc

Conversation

@reese
Copy link
Collaborator

@reese reese commented Jan 5, 2026

Currently the way we render tokens in the render queue is that we take the final tokens, convert each token into a Vec of concrete token types, and then flat_map them all together. This allocates a whole lot of intermediary Vecs for no real benefit.

This PR passes the single output Vec to each of these conversion methods and has each one just append to it directly.

@reese reese marked this pull request as ready for review January 5, 2026 18:24
@reese reese merged commit 7953c16 into trunk Jan 5, 2026
8 checks passed
@reese reese deleted the reese-vec-alloc branch January 5, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants