-
Notifications
You must be signed in to change notification settings - Fork 19
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
Prefer Vec<u8>/[u8]
over Vec<char>/[char]
#15
Comments
I totally agree. |
Doing so requires that when we parse a PDB file we assume it's all ASCII, is it OK? (the checks that are run when modifying the structure are preserved) |
Out of curiosity: what happened to this suggestion? I'm asking because I took another look during profiling and a decent chunk of the time |
Vec<u8>/[u8]
over Vec<char>/[char]
Vec<u8>/[u8]
over Vec<char>/[char]
The progress stalled. But changing to |
When creating a
Vec<char>
from a string,s.chars().collect()
is the standard practice. The.chars()
method works on any UTF-8 encoded string and it takes time to find the boundary for each character. However, we know that PDB files contain ASCII characters only, therefore it will be faster to transmute a string directly to bytes usingas_bytes()
and use vectors/arrays/slices of bytes instead ofchar
s throughout the crate. This practice is used, for example in rust-bio and seq-ioThe text was updated successfully, but these errors were encountered: