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

refactor: Roll our own hex utils #4470

Closed
wants to merge 5 commits into from

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Sep 15, 2024

hex does not seem to be maintained any longer and we already transitively depend on faster_hex anyways.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@Veykril Veykril force-pushed the veykril/push-kmnmkuvmsnzw branch 2 times, most recently from db4b2f9 to 9811f5a Compare September 15, 2024 11:42
lib/src/hex_util.rs Outdated Show resolved Hide resolved
lib/src/hex_util.rs Outdated Show resolved Hide resolved
lib/src/hex_util.rs Outdated Show resolved Hide resolved
lib/src/hex_util.rs Outdated Show resolved Hide resolved
lib/src/hex_util.rs Outdated Show resolved Hide resolved
lib/src/hex_util.rs Outdated Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
@@ -14,7 +14,17 @@

#![allow(missing_docs)]

fn to_reverse_hex_digit(b: u8) -> Option<u8> {
pub fn to_reverse_hex_digit(b: u8) -> u8 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might be simpler to do hex encoding by ourselves. It won't gain SIMD optimization, but the performance wouldn't matter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in roll all the hex stuff ourselves and put it into this module? Fine by me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I just meant to_reverse_hex(&str) -> Option<String> could be reimplemented as encode_reverse_hex(&[u8]) -> String.

It might be okay to self-host all hex encoding functions if that helps reduce dependency, though.

@Veykril Veykril marked this pull request as draft September 26, 2024 08:13
@Veykril Veykril force-pushed the veykril/push-kmnmkuvmsnzw branch 3 times, most recently from 233f3cf to b746a32 Compare September 26, 2024 08:59
@Veykril Veykril changed the title refactor: Replace hex crate with faster_hex refactor: Roll our own hex utils Sep 26, 2024
@Veykril Veykril force-pushed the veykril/push-kmnmkuvmsnzw branch 3 times, most recently from 0f5419f to e699f90 Compare September 26, 2024 09:10
@Veykril Veykril force-pushed the veykril/push-kmnmkuvmsnzw branch from e699f90 to 0d2a154 Compare September 26, 2024 09:11
@Veykril
Copy link
Member Author

Veykril commented Sep 26, 2024

Why is CI running nightly rustfmt 😕

@samueltardieu
Copy link
Contributor

Why is CI running nightly rustfmt 😕

The current state of the repository seems compatible with cargo fmt from the stable, beta and nightly toolchains.

@Veykril Veykril force-pushed the veykril/push-kmnmkuvmsnzw branch from 0d2a154 to 0ef4d22 Compare September 26, 2024 09:38
@Veykril
Copy link
Member Author

Veykril commented Sep 26, 2024

Ah wait, this is rustfmt working differently depending on how its invoked again I think (bare fmt invocation vs stdin). Nevermind then.

@Veykril Veykril marked this pull request as ready for review September 27, 2024 14:09
@Veykril
Copy link
Member Author

Veykril commented Oct 14, 2024

Closing this as I don't really have the drive for this refactoring right now

@Veykril Veykril closed this Oct 14, 2024
yuja added a commit to yuja/jj that referenced this pull request Oct 15, 2024
yuja added a commit that referenced this pull request Oct 16, 2024
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.

4 participants