Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

高速なHasherを使う (SipHashのかわりに) #156

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nusamai-3dtiles/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
serde = { version = "1.0.192", features = ["derive"] }
serde_json = { version = "1.0.108", features = ["float_roundtrip"] }
serde_json = { version = "1.0.108", features = ["indexmap", "float_roundtrip"] }
serde_repr = "0.1.17"
nusamai-gltf = { path = "../nusamai-gltf" }

Expand Down
3 changes: 2 additions & 1 deletion nusamai-citygml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ default = ["serde"]
serde = ["dep:serde", "serde_json", "nusamai-geometry/serde"]

[dependencies]
ahash = "0.8.7"
chrono = { version = "0.4.31", features = ["serde"], default-features = false }
indexmap = { version = "2.1", features = ["serde"] }
macros = { path = "./macros" }
nusamai-geometry = { path = "../nusamai-geometry", features = ["serde"]}
nusamai-projection = { path = "../nusamai-projection"}
quick-xml = "0.31"
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0.108", optional = true }
serde_json = { version = "1.0.108", features = ["indexmap"], optional = true }
thiserror = "1.0"
url = "2.5.0"
4 changes: 2 additions & 2 deletions nusamai-citygml/macros/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fn generate_citygml_impl_for_struct(
typename: #typename.into(),
id: #id_value,
attributes: {
let mut attributes = ::nusamai_citygml::object::Map::new();
let mut attributes = ::nusamai_citygml::object::Map::default();
#(#into_object_stmts)*
attributes
},
Expand All @@ -255,7 +255,7 @@ fn generate_citygml_impl_for_struct(
::nusamai_citygml::object::Data {
typename: #typename.into(),
attributes: {
let mut attributes = ::nusamai_citygml::object::Map::new();
let mut attributes = ::nusamai_citygml::object::Map::default();
#(#into_object_stmts)*
attributes
},
Expand Down
2 changes: 1 addition & 1 deletion nusamai-citygml/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct GeometryStore {

#[derive(Default)]
pub(crate) struct GeometryCollector {
pub vertices: indexmap::IndexSet<[u64; 3]>,
pub vertices: indexmap::IndexSet<[u64; 3], ahash::RandomState>,
pub multipolygon: MultiPolygon<'static, 1, u32>,
pub multilinestring: MultiLineString<'static, 1, u32>,
pub multipoint: MultiPoint<'static, 1, u32>,
Expand Down
6 changes: 3 additions & 3 deletions nusamai-citygml/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::Measure;
use chrono::NaiveDate;
use serde::{Deserialize, Serialize};

pub type Map = indexmap::IndexMap<String, Value>;
pub type Map = indexmap::IndexMap<String, Value, ahash::RandomState>;

#[derive(Debug, Deserialize, Serialize)]
pub struct CityObject {
Expand Down Expand Up @@ -136,7 +136,7 @@ mod tests {
let value = obj.to_attribute_json();
assert_eq!(value, json!(["test", 1]));

let mut attributes = Map::new();
let mut attributes = Map::default();
attributes.insert("String".into(), Value::String("test".into()));
attributes.insert("Integer".into(), Value::Integer(1));
let obj = Value::Feature(Feature {
Expand All @@ -158,7 +158,7 @@ mod tests {
}
);

let mut attributes = Map::new();
let mut attributes = Map::default();
attributes.insert("String".into(), Value::String("test".into()));
attributes.insert("Integer".into(), Value::Integer(1));
let obj = Value::Data(Data {
Expand Down
2 changes: 1 addition & 1 deletion nusamai-citygml/src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl CityGMLElement for GenericAttribute {
}

fn into_object(self) -> Option<Value> {
let mut map = object::Map::new();
let mut map = object::Map::default();
map.extend(
self.string_attrs
.into_iter()
Expand Down
2 changes: 1 addition & 1 deletion nusamai-geojson/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ edition = "2021"
[dependencies]
geojson = "0.24.1"
nusamai-geometry = { path = "../nusamai-geometry" }
serde_json = "1.0.108"
serde_json = { version = "1.0.108", features = ["indexmap"] }
2 changes: 1 addition & 1 deletion nusamai-gltf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
serde = { version = "1.0.192", features = ["derive"] }
serde_json = { version = "1.0.108", features = ["float_roundtrip"] }
serde_json = { version = "1.0.108", features = ["indexmap", "float_roundtrip"] }
serde_repr = "0.1.17"

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions nusamai-plateau/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ nusamai-citygml = { path = "../nusamai-citygml", features = ["serde"]}
chrono = { version = "0.4.31", features = ["serde"], default-features = false }
url = "2.5.0"
stretto = "0.8.2"
hashbrown = "0.14.3"

[dev-dependencies]
zstd = { version = "0.13.0", features = ["zdict_builder"] }
Expand Down
8 changes: 5 additions & 3 deletions nusamai-plateau/src/codelist/resolver.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use std::{collections::HashMap, path::PathBuf};
use std::path::PathBuf;

use super::xml::{parse_dictionary, Definition};
use nusamai_citygml::codelist::CodeResolver;
use nusamai_citygml::ParseError;
use hashbrown::HashMap;
use stretto::Cache;
use url::Url;

use nusamai_citygml::codelist::CodeResolver;
use nusamai_citygml::ParseError;

pub struct Resolver {
cache: Cache<PathBuf, HashMap<String, Definition>>,
}
Expand Down
4 changes: 2 additions & 2 deletions nusamai-plateau/src/codelist/xml.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::HashMap;
use hashbrown::HashMap;
use std::io::BufRead;

use quick_xml::events::Event;
Expand Down Expand Up @@ -113,7 +113,7 @@ pub fn parse_dictionary<R: BufRead>(
let mut depth = 0;
let mut buf = Vec::new();
let mut buf2 = Vec::new();
let mut definitions = HashMap::new();
let mut definitions = HashMap::default();

loop {
match reader.read_event_into(&mut buf) {
Expand Down
2 changes: 1 addition & 1 deletion nusamai/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nusamai-geojson = { path = "../nusamai-geojson" }
nusamai-geometry = { path = "../nusamai-geometry" }
nusamai-projection = { path = "../nusamai-projection" }
geojson = "0.24.1"
serde_json = "1.0.108"
serde_json = { version = "1.0.108", features = ["indexmap"] }
url = "2.5.0"
nusamai-gpkg = { path = "../nusamai-gpkg" }
tokio = { version = "1.35.1", features = ["full"] }
Expand Down