jiff/bench
Andrew Gallant a22abc7617
bench: add benchmarks for constructing a timestamp type
Both `chrono` and `time` use more elaborate representations for their
canonical "timestamp" data types. In contrast, Jiff just uses an integer
number of nanoseconds (like `std::time::Duration`). This makes, among
other things, construction from an integer virtually free:

    $ cargo bench -- timestamp/from_seconds
    timestamp/from_seconds/span/jiff
                            time:   [385.45 ps 385.53 ps 385.62 ps]
    Found 7 outliers among 100 measurements (7.00%)
      1 (1.00%) high mild
      6 (6.00%) high severe

    timestamp/from_seconds/duration/chrono
                            time:   [4.6363 ns 4.6375 ns 4.6387 ns]
    Found 9 outliers among 100 measurements (9.00%)
      5 (5.00%) high mild
      4 (4.00%) high severe

    timestamp/from_seconds/duration/time
                            time:   [9.6360 ns 9.6387 ns 9.6418 ns]
    Found 8 outliers among 100 measurements (8.00%)
      5 (5.00%) high mild
      3 (3.00%) high severe

Chrono doesn't really have a "timestamp" type, but `DateTime<Utc>` is
the de facto choice. `time` just recently added a `UtcDateTime` type,
which also feels a lot like a timestamp type, but its representation is
more elaborate than Jiff's.
2025-03-31 18:31:59 -04:00
..
src bench: add benchmarks for constructing a timestamp type 2025-03-31 18:31:59 -04:00
.gitignore first substantial commit 2024-07-21 20:15:13 -04:00
Cargo.toml bench: make some small updates to benchmarks 2025-03-05 18:48:44 -05:00