Skip to content

Reduce / pass in allocations #146

@taj-p

Description

@taj-p

Hi!

I'm a new consumer of unicode-bidi from https://github.com/linebender/parley (integration PR).

I'm wondering what the appetite is for allowing consumers to pass in allocations to BidiInfo rather than allocations be created on a per run basis; see some example allocations:

InitialInfoExt

unicode-bidi/src/lib.rs

Lines 277 to 278 in 3bf3403

let mut paragraphs = Vec::<ParagraphInfo>::new();
let mut flags = Vec::<ParagraphInfoFlags>::new();

let mut original_classes = Vec::with_capacity(text.len());

BidiInfo

unicode-bidi/src/lib.rs

Lines 505 to 506 in 3bf3403

let mut levels = Vec::<Level>::with_capacity(text.len());
let mut processing_classes = base.original_classes.clone();

I'm happy to try to brainstorm a solution to enable this, but am more than happy to defer to maintainer direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions