ens-normalize-rs 0.2.0

Ethereum Name Service (ENS) name normalization
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const SIZE: usize = 100;
const NAME_LENGTH: usize = 1000;
const NAME: &str = "$Sand-#️⃣🇪🇨";

fn main() {
    let now = std::time::Instant::now();
    let n = NAME_LENGTH / NAME.len();
    let name = std::iter::repeat_n(NAME, n).collect::<Vec<_>>().join("");
    let normalizer = ens_normalize_rs::EnsNameNormalizer::default();
    for _ in 0..SIZE {
        let _name = normalizer.process(&name).unwrap();
    }
    // Total time to process 100 names: 1.064667541s
    println!("Total time to process {SIZE} names: {:?}", now.elapsed());
}