Skip to content

Commit

Permalink
feat(rust): add zone-detect-rs to benchmark (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn authored Sep 15, 2024
1 parent 1247f05 commit fc121c1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
14 changes: 12 additions & 2 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rtz = { git = "https://github.com/twitchax/rtz", features = [
"full",
"self-contained",
], rev = "021eab5" }
zone-detect = "1.0.0"
spatialtime = { version = "0.2.0", features = ["osm", "ned"]}

[profile.bench]
Expand Down
12 changes: 12 additions & 0 deletions rust/benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ mod benches_tz_crates {
});
}

#[bench]
fn bench_zone_detect_random_city(b: &mut Bencher) {
let database = zone_detect::Database::open("data/timezone21.bin").expect("failed to open database");
b.iter(|| {
let city = cities_json::get_random_cities();
let _ = database.simple_lookup(zone_detect::Location {
latitude: city.lat as f32,
longitude: city.lng as f32,
}).unwrap();
});
}

#[bench]
fn bench_spatialtime_ned(b: &mut Bencher) {
b.iter(|| {
Expand Down
Binary file added rust/data/timezone21.bin
Binary file not shown.

0 comments on commit fc121c1

Please sign in to comment.