You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a few potential performance wins you can explore here I think.
Use a trie rather than a linear scan for the prefix matching.
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.
The text was updated successfully, but these errors were encountered:
There are a few potential performance wins you can explore here I think.
filter
. For example, by directly building aVec<u8>
instead of aString
. Currently there are two allocations, aVec<&str>
andString
. With that approach you'd only have one and you could potentially allocate with too much capacity to prevent resizing theVec
.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 infilter
.The text was updated successfully, but these errors were encountered: