Skip to content

Reduce allocations#12

Open
matthiasbeyer wants to merge 3 commits intoaskldjd:mainfrom
matthiasbeyer:reduce-allocations
Open

Reduce allocations#12
matthiasbeyer wants to merge 3 commits intoaskldjd:mainfrom
matthiasbeyer:reduce-allocations

Conversation

@matthiasbeyer
Copy link

This depends on #11 I guess (the PR branch is based on the PR branch from #11)

Please review carefully and also see the commit message of the last commit for a rationale.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This refactoring might have a performance impact (cannot measure).
With this patch, the return value in the `filter()` function is not a
`String` anymore, but a list of references: `Vec<&str>`.

Previously, the `String` was only processed further if it was non-empty.
An empty Vec<&str> is the same as an empty `String`: Not relevant for
further processing.

Hence, we can optimize this and join the `Vec<&str>` to `String` only if
it is not empty.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
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.

1 participant