Skip to content

Commit f257da1

Browse files
committed
Release v7.0.0
1 parent 50cefd3 commit f257da1

File tree

5 files changed

+1158
-359
lines changed

5 files changed

+1158
-359
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
cargo +nightly fmt --all -- --check
4848
- name: Cargo test
4949
if: matrix.action == 'test'
50-
run: cargo test --profile ci-dev --workspace --all-features --all-targets --locked
50+
run: RUST_MIN_STACK=67108864 cargo test --profile ci-dev --workspace --all-features --all-targets --locked
5151
- name: Fast fail
5252
uses: vishnudxb/[email protected]
5353
if: failure()

CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v7.0.0
2+
- Improve docs.
3+
- Improve tests.
4+
- Add `se_hex`, `se_hex_without_prefix`.
5+
- Rename `de_hex2num` to `de_try_from_hex` and make it support more types.
6+
- Remove `de_hex2bytes`.
7+
18
## v6.2.3
29
- Add `slice2array_ref` and `slice2array_ref_unchecked`.
310
- Bump dependencies.

README.md

Lines changed: 59 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- type `AsRef<[u8]> -> u64`
3030
- type `AsRef<[u8]> -> u128`
3131
- Convert hex to array
32-
- type `AsRef<[u8]> -> [u8; N]`, `N = { [1, 64], 128, 256, 512 }`
32+
- type `AsRef<[u8]> -> [u8; N]`, `N = { [1, 64], 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536 }`
3333
- type `AsRef<[u8]> -> Vec<u8>`
3434

3535
#### `Hex` trait
@@ -48,7 +48,7 @@
4848
- type `u128 -> String`
4949
- Convert array to hex
5050
- type `Vec<u8> -> String`
51-
- type `[u8; N] -> String`, `N = { [1, 64], 128, 256, 512 }`
51+
- type `[u8; N] -> String`, `N = { [1, 64], 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536 }`
5252
- type `&[u8] -> String`
5353

5454
#### `slice` prefixed functions
@@ -91,125 +91,96 @@
9191
- `#[serde(deserialize_with = "array_bytes::hex_deserialize_n_into")]`
9292
- type `S -> T`
9393
- e.g. `"0x..." -> H160`
94-
- `#[serde(deserialize_with = "array_bytes::de_hex2num")]`
95-
- type `S -> Num`
94+
- `#[serde(deserialize_with = "array_bytes::de_try_from_hex")]`
95+
- type `S -> impl TryFromHex`
9696
- e.g. `"0xA" -> 10_u32`
97-
- `#[serde(deserialize_with = "array_bytes::de_hex2bytes")]`
98-
- type `S -> Vec<u8>`
97+
- `#[serde(serialize_with = "array_bytes::se_hex")]`
98+
- type `S -> impl Hex`
9999
- e.g. `"0x00" -> vec![0_u8]`
100100

101101
## Benchmark results
102102
<div align="right"><sub>Tuesday, January 9th, 2024</sub></div>
103103

104104
```rs
105-
array_bytes::bytes2hex time: [30.487 µs 30.513 µs 30.543 µs]
106-
change: [-12.758% -7.1673% -2.3095%] (p = 0.00 < 0.05)
107-
Performance has improved.
105+
array_bytes::bytes2hex time: [26.426 µs 26.473 µs 26.518 µs]
108106
Found 4 outliers among 100 measurements (4.00%)
109-
3 (3.00%) high mild
107+
2 (2.00%) low mild
108+
1 (1.00%) high mild
110109
1 (1.00%) high severe
111110

112-
const_hex::encode time: [2.1197 µs 2.2245 µs 2.3208 µs]
113-
change: [+25.796% +31.010% +36.449%] (p = 0.00 < 0.05)
114-
Performance has regressed.
111+
const_hex::encode time: [994.78 ns 1.0084 µs 1.0232 µs]
115112

116-
faster_hex::hex_string time: [13.666 µs 13.711 µs 13.754 µs]
117-
change: [-0.3508% +0.0892% +0.5043%] (p = 0.68 > 0.05)
118-
No change in performance detected.
113+
faster_hex::hex_string time: [11.728 µs 11.769 µs 11.815 µs]
119114

120115
faster_hex::hex_encode_fallback
121-
time: [13.476 µs 13.519 µs 13.564 µs]
122-
change: [-0.1799% +0.2323% +0.6560%] (p = 0.27 > 0.05)
123-
No change in performance detected.
116+
time: [11.704 µs 11.737 µs 11.773 µs]
124117
Found 1 outliers among 100 measurements (1.00%)
125118
1 (1.00%) high mild
126119

127-
hex::encode time: [133.99 µs 135.65 µs 137.13 µs]
128-
change: [-1.6763% +0.2181% +2.1203%] (p = 0.82 > 0.05)
129-
No change in performance detected.
130-
Found 15 outliers among 100 measurements (15.00%)
131-
13 (13.00%) low severe
132-
2 (2.00%) low mild
120+
hex::encode time: [86.105 µs 86.250 µs 86.433 µs]
121+
Found 14 outliers among 100 measurements (14.00%)
122+
1 (1.00%) low severe
123+
4 (4.00%) low mild
124+
6 (6.00%) high mild
125+
3 (3.00%) high severe
133126

134-
rustc_hex::to_hex time: [118.83 µs 124.46 µs 129.51 µs]
135-
change: [-3.5525% +2.8439% +10.307%] (p = 0.42 > 0.05)
136-
No change in performance detected.
127+
rustc_hex::to_hex time: [44.486 µs 45.538 µs 46.723 µs]
128+
Found 16 outliers among 100 measurements (16.00%)
129+
1 (1.00%) low mild
130+
2 (2.00%) high mild
131+
13 (13.00%) high severe
137132

138-
array_bytes::hex2bytes time: [46.892 µs 47.510 µs 48.195 µs]
139-
change: [-8.2282% -6.5411% -4.6367%] (p = 0.00 < 0.05)
140-
Performance has improved.
141-
Found 6 outliers among 100 measurements (6.00%)
142-
1 (1.00%) high mild
143-
5 (5.00%) high severe
133+
array_bytes::hex2bytes time: [43.576 µs 44.529 µs 45.404 µs]
134+
Performance has regressed.
135+
Found 11 outliers among 100 measurements (11.00%)
136+
7 (7.00%) low mild
137+
4 (4.00%) high mild
144138

145139
array_bytes::hex2bytes_unchecked
146-
time: [73.450 µs 73.842 µs 74.251 µs]
147-
change: [+0.5740% +1.3693% +2.1806%] (p = 0.00 < 0.05)
148-
Change within noise threshold.
149-
Found 17 outliers among 100 measurements (17.00%)
150-
11 (11.00%) low mild
151-
5 (5.00%) high mild
152-
1 (1.00%) high severe
140+
time: [64.190 µs 65.311 µs 66.359 µs]
153141

154-
array_bytes::hex2slice time: [57.825 µs 57.915 µs 58.007 µs]
155-
change: [-0.9051% -0.6249% -0.3523%] (p = 0.00 < 0.05)
156-
Change within noise threshold.
157-
Found 6 outliers among 100 measurements (6.00%)
158-
6 (6.00%) high mild
142+
array_bytes::hex2slice time: [45.484 µs 46.988 µs 48.736 µs]
143+
Performance has regressed.
144+
Found 12 outliers among 100 measurements (12.00%)
145+
2 (2.00%) high mild
146+
10 (10.00%) high severe
159147

160148
array_bytes::hex2slice_unchecked
161-
time: [73.574 µs 73.917 µs 74.281 µs]
162-
change: [-4.9137% -4.1840% -3.4519%] (p = 0.00 < 0.05)
163-
Performance has improved.
164-
Found 13 outliers among 100 measurements (13.00%)
165-
8 (8.00%) high mild
166-
5 (5.00%) high severe
149+
time: [62.339 µs 63.317 µs 64.279 µs]
150+
Performance has regressed.
167151

168-
const_hex::decode time: [15.849 µs 15.887 µs 15.924 µs]
169-
change: [-3.1788% -2.1280% -1.2019%] (p = 0.00 < 0.05)
152+
const_hex::decode time: [13.601 µs 13.629 µs 13.665 µs]
170153
Performance has improved.
154+
Found 2 outliers among 100 measurements (2.00%)
155+
1 (1.00%) low mild
156+
1 (1.00%) high severe
171157

172-
faster_hex::hex_decode time: [31.735 µs 31.764 µs 31.800 µs]
173-
change: [-0.7403% -0.5216% -0.2674%] (p = 0.00 < 0.05)
174-
Change within noise threshold.
175-
Found 7 outliers among 100 measurements (7.00%)
176-
5 (5.00%) high mild
177-
2 (2.00%) high severe
158+
faster_hex::hex_decode time: [28.015 µs 28.061 µs 28.110 µs]
159+
Performance has improved.
160+
Found 1 outliers among 100 measurements (1.00%)
161+
1 (1.00%) high mild
178162

179163
faster_hex::hex_decode_unchecked
180-
time: [13.059 µs 13.098 µs 13.145 µs]
181-
change: [-0.7125% -0.3968% -0.1100%] (p = 0.01 < 0.05)
182-
Change within noise threshold.
183-
Found 10 outliers among 100 measurements (10.00%)
184-
6 (6.00%) high mild
185-
4 (4.00%) high severe
164+
time: [11.782 µs 11.797 µs 11.812 µs]
165+
Found 3 outliers among 100 measurements (3.00%)
166+
2 (2.00%) low severe
167+
1 (1.00%) low mild
186168

187169
faster_hex::hex_decode_fallback
188-
time: [13.074 µs 13.090 µs 13.108 µs]
189-
change: [-1.9404% -1.5652% -1.1912%] (p = 0.00 < 0.05)
190-
Performance has improved.
191-
Found 9 outliers among 100 measurements (9.00%)
192-
5 (5.00%) high mild
193-
4 (4.00%) high severe
170+
time: [11.748 µs 11.767 µs 11.785 µs]
171+
Found 7 outliers among 100 measurements (7.00%)
172+
2 (2.00%) low severe
173+
4 (4.00%) low mild
174+
1 (1.00%) high mild
194175

195-
hex::decode time: [131.19 µs 132.57 µs 134.26 µs]
196-
change: [+1.9126% +3.2801% +4.8702%] (p = 0.00 < 0.05)
197-
Performance has regressed.
198-
Found 15 outliers among 100 measurements (15.00%)
199-
15 (15.00%) high severe
176+
hex::decode time: [93.055 µs 94.781 µs 96.583 µs]
200177

201-
hex::decode_to_slice time: [57.577 µs 58.018 µs 58.447 µs]
202-
change: [+0.0185% +1.1253% +2.2104%] (p = 0.04 < 0.05)
203-
Change within noise threshold.
204-
Found 2 outliers among 100 measurements (2.00%)
205-
1 (1.00%) high mild
206-
1 (1.00%) high severe
178+
hex::decode_to_slice time: [31.949 µs 33.509 µs 35.285 µs]
179+
Found 13 outliers among 100 measurements (13.00%)
180+
5 (5.00%) high mild
181+
8 (8.00%) high severe
207182

208-
rustc_hex::from_hex time: [130.19 µs 130.86 µs 131.48 µs]
209-
change: [-1.8542% -1.4374% -0.9862%] (p = 0.00 < 0.05)
210-
Change within noise threshold.
211-
Found 2 outliers among 100 measurements (2.00%)
212-
2 (2.00%) high mild
183+
rustc_hex::from_hex time: [105.99 µs 108.05 µs 110.11 µs]
213184
```
214185

215186
<div align="right">

0 commit comments

Comments
 (0)