Skip to content

Commit

Permalink
fix test random
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Feb 2, 2025
1 parent 81323df commit 100b0f4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 27 deletions.
53 changes: 36 additions & 17 deletions Cargo.lock

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

16 changes: 10 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ version = "0.4.10"
[dependencies]
anyhow = "1"
bytes = "1"
clap = {version = "4", features = ["color", "help", "usage", "derive"], optional = true}
clap = { version = "4", features = [
"color",
"help",
"usage",
"derive",
], optional = true }
prost = "0.13"
rand = "0.8.5"

# tzf-rel = { git = "https://github.com/ringsaturn/tzf-rel", tag = "v0.0.2022-f5"}
tzf-rel = "0.0.2025-a"
Expand All @@ -28,10 +32,10 @@ geometry-rs = "0.2.1"
[dev-dependencies]
lazy_static = "1.5.0"

criterion = {version = "0.5", features = ["html_reports"]}
criterion = { version = "0.5", features = ["html_reports"] }

# cities-json = { git = "https://github.com/ringsaturn/go-cities.json", rev = "38a818ded6dcd1759e4633a36502b693c8b14858" }
cities-json = "0"
cities-json = { git = "https://github.com/ringsaturn/go-cities.json" , rev = "0660039" }
# cities-json = "0"

[features]
default = ["clap"]
Expand All @@ -52,4 +56,4 @@ prost-build = "0.13.4"
lto = true

[target.'cfg(not(target_env = "msvc"))'.dev-dependencies]
pprof = {version = "0.14", features = ["flamegraph"]}
pprof = { version = "0.14", features = ["flamegraph"] }
7 changes: 3 additions & 4 deletions benches/finders.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use cities_json::CITIES;
use cities_json::get_random_cities;
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use lazy_static::lazy_static;
use rand::seq::SliceRandom;
use tzf_rs::{DefaultFinder, Finder};

lazy_static! {
Expand All @@ -10,12 +9,12 @@ lazy_static! {
}

fn bench_default_finder_random_city(_i: usize) {
let city = CITIES.choose(&mut rand::thread_rng()).unwrap();
let city = get_random_cities();
let _ = DEFAULT_FINDER.get_tz_name(city.lng, city.lat);
}

fn bench_finder_random_city(_i: usize) {
let city = CITIES.choose(&mut rand::thread_rng()).unwrap();
let city = get_random_cities();
let _ = FINDER.get_tz_name(city.lng, city.lat);
}

Expand Down

0 comments on commit 100b0f4

Please # to comment.