Skip to content

Commit b843c98

Browse files
authored
Add const-hex to bench (#116)
1 parent 9023958 commit b843c98

File tree

3 files changed

+129
-0
lines changed

3 files changed

+129
-0
lines changed

Cargo.lock

Lines changed: 120 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ criterion = { version = "0.5" }
3232
faster-hex = { version = "0.9" }
3333
hex = { version = "0.4" }
3434
rustc-hex = { version = "2.1" }
35+
const-hex = { version = "1.1" }
3536
serde = { version = "1.0", features = ["derive"] }
3637
serde_json = { version = "1.0" }
3738

benches/bench.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ fn bench_encode(c: &mut Criterion) {
1212

1313
c.bench_function("hex::encode", |b| b.iter(|| hex::encode(DATA)));
1414

15+
c.bench_function("const_hex::encode", |b| b.iter(|| const_hex::encode(DATA)));
16+
1517
c.bench_function("rustc_hex::to_hex", |b| b.iter(|| DATA.to_hex::<String>()));
1618

1719
c.bench_function("faster_hex::hex_string", |b| b.iter(|| faster_hex::hex_string(DATA)));
@@ -64,6 +66,12 @@ fn bench_decode(c: &mut Criterion) {
6466
})
6567
});
6668

69+
c.bench_function("const_hex::decode", |b| {
70+
let hex = const_hex::encode(DATA);
71+
72+
b.iter(|| const_hex::decode(&hex).unwrap())
73+
});
74+
6775
c.bench_function("hex::decode", |b| {
6876
let hex = hex::encode(DATA);
6977

0 commit comments

Comments
 (0)