dylanhart / ulid-rs

This is a Rust implementation of the ulid project
https://crates.io/crates/ulid
MIT License
385 stars 37 forks source link

Investigate chrono -> time perf regressions #50

Closed dylanhart closed 2 years ago

dylanhart commented 2 years ago

All methods touching the time package a significantly slower than their chrono counterparts.

v0.5.0

git checkout v0.5.0
cargo bench
test bench_from_string        ... bench:          14 ns/iter (+/- 2)
test bench_from_time          ... bench:           8 ns/iter (+/- 0)
test bench_generator_generate ... bench:          42 ns/iter (+/- 1)
test bench_new                ... bench:          44 ns/iter (+/- 0)
test bench_to_str             ... bench:           7 ns/iter (+/- 0)
test bench_to_string          ... bench:          20 ns/iter (+/- 0)

v0.6.0

git checkout v0.6.0
cargo bench
test bench_from_string        ... bench:          13 ns/iter (+/- 1)
test bench_from_time          ... bench:          12 ns/iter (+/- 1)
test bench_generator_generate ... bench:          55 ns/iter (+/- 1)
test bench_new                ... bench:          58 ns/iter (+/- 1)
test bench_to_str             ... bench:           7 ns/iter (+/- 0)
test bench_to_string          ... bench:          20 ns/iter (+/- 1)
dylanhart commented 2 years ago

The dependency on time has been dropped.