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

use split_once instead of split to parse lsn strings #1118

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

laxjesse
Copy link
Contributor

str::split allocates a vector and generates considerably more instructions when compiled than str::split_once.

u64::from_str_radix(split_lo, 16) will error if the lsn_str contains more than one / so this change should result in the same behavior as the current implementation despite not explicitly checking this.

[`str::split`](https://doc.rust-lang.org/std/primitive.str.html#method.split)
allocates a vector and generates considerably more instructions when compiled
than [`str::split_once`](https://doc.rust-lang.org/std/primitive.str.html#method.split_once).

[`u64::from_str_radix(split_lo, 16)`](https://doc.rust-lang.org/std/primitive.u64.html#method.from_str_radix)
will error if the `lsn_str` contains more than one `/` so this change should
result in the same behavior as the current implementation despite not explicitly
checking this.
@sfackler
Copy link
Owner

Thanks! The CI failure is unrelated - I'll fix that later.

@sfackler sfackler merged commit e528e01 into sfackler:master Mar 13, 2024
3 of 4 checks passed
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.

2 participants