Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential performance wins #8

Open
k0nserv opened this issue May 7, 2021 · 0 comments
Open

Potential performance wins #8

k0nserv opened this issue May 7, 2021 · 0 comments

Comments

@k0nserv
Copy link

k0nserv commented May 7, 2021

There are a few potential performance wins you can explore here I think.

  1. Use a trie rather than a linear scan for the prefix matching.
  2. You could allocate less in filter. For example, by directly building a Vec<u8> instead of a String. Currently there are two allocations, a Vec<&str> and String. With that approach you'd only have one and you could potentially allocate with too much capacity to prevent resizing the Vec.

EDIT: With the signature pub fn filter(block_list: &Vec<String>, buf: &mut [u8]) -> &mut [u8] and some index fiddlig you could probably entirely avoid allocations in filter.

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

No branches or pull requests

1 participant