Skip to content

Consider using an RcVec type that collocates reference count with vector elements #336

@dtolnay

Description

@dtolnay

As of #335, TokenStream is Rc<Vec<TokenTree>>. This makes twice as many allocations as it should, because there's one that holds {strong count, weak count, data ptr, length, capacity} and a different one that holds the vector elements.

Let's look into putting these all into one allocation (except omit weak count, which we do not use) and see how it affects cargo bench --bench file --features full,parsing,test in syn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions