diff --git a/.changeset/giant-clubs-jump.md b/.changeset/giant-clubs-jump.md new file mode 100644 index 00000000..51376521 --- /dev/null +++ b/.changeset/giant-clubs-jump.md @@ -0,0 +1,5 @@ +--- +"eppo_core": minor +--- + +[ahash] Add "ahash" feature flag to use faster hash function for all hashmaps. It is changing the public interface so is disabled by default so as to not cause breakage across SDKs and allow them to update one by one. diff --git a/.changeset/twenty-owls-tan.md b/.changeset/twenty-owls-tan.md new file mode 100644 index 00000000..c3cb636e --- /dev/null +++ b/.changeset/twenty-owls-tan.md @@ -0,0 +1,6 @@ +--- +"python-sdk": patch +"ruby-sdk": patch +--- + +perf: use faster hash function for internal hashmaps (ahash). diff --git a/eppo_core/Cargo.toml b/eppo_core/Cargo.toml index 49890dad..48df66ca 100644 --- a/eppo_core/Cargo.toml +++ b/eppo_core/Cargo.toml @@ -10,6 +10,9 @@ categories = ["config"] rust-version = "1.80.0" [features] +# Use ahash for HashMaps. This is currently disabled by default to +# allow SDKs adapt their usage one by one. +ahash = ["dep:ahash"] # Unstable feature flag for an upcoming feature. event_ingestion = ["dep:uuid", "dep:exponential-backoff"] # Add implementation of `FromPyObject`/`ToPyObject` for some types. @@ -24,6 +27,7 @@ rustler = ["dep:rustler"] vendored = [] [dependencies] +ahash = { version = "0.8.12", optional = true } base64 = "0.22.1" chrono = { version = "0.4.38", features = ["serde"] } derive_more = { version = "2.0.0", default-features = false, features = ["from", "into"] } diff --git a/eppo_core/benches/bandit_evaluation.rs b/eppo_core/benches/bandit_evaluation.rs index 8380355f..daee9eae 100644 --- a/eppo_core/benches/bandit_evaluation.rs +++ b/eppo_core/benches/bandit_evaluation.rs @@ -1,9 +1,13 @@ -use std::collections::HashMap; use std::fs::File; use chrono::Utc; use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput}; +#[cfg(feature = "ahash")] +use eppo_core::ahash::{HashMap, HashMapExt}; +#[cfg(not(feature = "ahash"))] +use std::collections::HashMap; + use eppo_core::ufc::UniversalFlagConfig; use eppo_core::{eval::get_bandit_action, Configuration, ContextAttributes, SdkMetadata, Str}; diff --git a/eppo_core/benches/evaluation_details.rs b/eppo_core/benches/evaluation_details.rs index f6981197..babc1a8f 100644 --- a/eppo_core/benches/evaluation_details.rs +++ b/eppo_core/benches/evaluation_details.rs @@ -1,8 +1,13 @@ -use std::{collections::HashMap, sync::Arc}; +use std::sync::Arc; use chrono::Utc; use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput}; +#[cfg(feature = "ahash")] +use eppo_core::ahash::{HashMap, HashMapExt}; +#[cfg(not(feature = "ahash"))] +use std::collections::HashMap; + use eppo_core::ufc::UniversalFlagConfig; use eppo_core::{ eval::{get_assignment, get_assignment_details}, @@ -55,7 +60,11 @@ fn criterion_benchmark(c: &mut Criterion) { { let mut group = c.benchmark_group("rollout"); group.throughput(Throughput::Elements(1)); - let attributes = Arc::new([("country".into(), "US".into())].into()); + let attributes = { + let mut map = HashMap::new(); + map.insert("country".into(), "US".into()); + Arc::new(map) + }; group.bench_function("get_assignment", |b| { b.iter(|| { get_assignment( @@ -86,7 +95,7 @@ fn criterion_benchmark(c: &mut Criterion) { { let mut group = c.benchmark_group("json-config-flag"); group.throughput(Throughput::Elements(1)); - let attributes = Arc::new([].into()); + let attributes = Arc::new(HashMap::new()); group.bench_function("get_assignment", |b| { b.iter(|| { get_assignment( @@ -117,7 +126,11 @@ fn criterion_benchmark(c: &mut Criterion) { { let mut group = c.benchmark_group("numeric-one-of"); group.throughput(Throughput::Elements(1)); - let attributes = Arc::new([("number".into(), 2.0.into())].into()); + let attributes = { + let mut map = HashMap::new(); + map.insert("number".into(), 2.0.into()); + Arc::new(map) + }; group.bench_function("get_assignment", |b| { b.iter(|| { get_assignment( @@ -148,7 +161,11 @@ fn criterion_benchmark(c: &mut Criterion) { { let mut group = c.benchmark_group("regex-flag"); group.throughput(Throughput::Elements(1)); - let attributes = Arc::new([("email".into(), "test@gmail.com".into())].into()); + let attributes = { + let mut map = HashMap::new(); + map.insert("email".into(), "test@gmail.com".into()); + Arc::new(map) + }; group.bench_function("get_assignment", |b| { b.iter(|| { get_assignment( diff --git a/eppo_core/src/attributes.rs b/eppo_core/src/attributes.rs index 2e4f2d89..602b488b 100644 --- a/eppo_core/src/attributes.rs +++ b/eppo_core/src/attributes.rs @@ -1,8 +1,8 @@ -use std::{borrow::Cow, collections::HashMap, sync::Arc}; +use std::{borrow::Cow, sync::Arc}; use serde::{Deserialize, Serialize}; -use crate::Str; +use crate::{hashmap::HashMap, Str}; mod context_attributes; diff --git a/eppo_core/src/attributes/context_attributes.rs b/eppo_core/src/attributes/context_attributes.rs index c22ec711..1386e44a 100644 --- a/eppo_core/src/attributes/context_attributes.rs +++ b/eppo_core/src/attributes/context_attributes.rs @@ -1,8 +1,8 @@ -use std::{collections::HashMap, sync::Arc}; +use std::sync::Arc; use serde::{Deserialize, Serialize}; -use crate::Str; +use crate::{hashmap::*, Str}; use super::{ AttributeValue, AttributeValueImpl, Attributes, CategoricalAttribute, NumericAttribute, @@ -81,11 +81,11 @@ impl ContextAttributes { #[cfg(feature = "pyo3")] mod pyo3_impl { - use std::{collections::HashMap, sync::Arc}; + use std::sync::Arc; use pyo3::{prelude::*, types::PyDict}; - use crate::{Attributes, CategoricalAttribute, NumericAttribute, Str}; + use crate::{hashmap::*, Attributes, CategoricalAttribute, NumericAttribute, Str}; use super::ContextAttributes; diff --git a/eppo_core/src/bandits.rs b/eppo_core/src/bandits.rs index 9e5d5678..6afe2a8a 100644 --- a/eppo_core/src/bandits.rs +++ b/eppo_core/src/bandits.rs @@ -1,6 +1,6 @@ #![allow(missing_docs)] -use std::collections::HashMap; +use crate::hashmap::HashMap; use serde::{Deserialize, Serialize}; diff --git a/eppo_core/src/configuration_store.rs b/eppo_core/src/configuration_store.rs index 6e7bac3a..1ea64b61 100644 --- a/eppo_core/src/configuration_store.rs +++ b/eppo_core/src/configuration_store.rs @@ -46,8 +46,9 @@ impl ConfigurationStore { #[cfg(test)] mod tests { - use std::{collections::HashMap, sync::Arc}; + use std::sync::Arc; + use crate::hashmap::*; use chrono::Utc; use super::ConfigurationStore; diff --git a/eppo_core/src/eval/eval_bandits.rs b/eppo_core/src/eval/eval_bandits.rs index 2911f35a..e6a6155a 100644 --- a/eppo_core/src/eval/eval_bandits.rs +++ b/eppo_core/src/eval/eval_bandits.rs @@ -1,6 +1,7 @@ -use std::collections::HashMap; use std::sync::Arc; +use crate::hashmap::HashMap; + use chrono::{DateTime, Utc}; use serde::Serialize; diff --git a/eppo_core/src/eval/eval_details_builder.rs b/eppo_core/src/eval/eval_details_builder.rs index 33b65ffb..9bbee7e6 100644 --- a/eppo_core/src/eval/eval_details_builder.rs +++ b/eppo_core/src/eval/eval_details_builder.rs @@ -1,4 +1,6 @@ -use std::{collections::HashMap, sync::Arc}; +use std::sync::Arc; + +use crate::hashmap::*; use chrono::{DateTime, Utc}; diff --git a/eppo_core/src/eval/eval_precomputed.rs b/eppo_core/src/eval/eval_precomputed.rs index ad359893..5428bb12 100644 --- a/eppo_core/src/eval/eval_precomputed.rs +++ b/eppo_core/src/eval/eval_precomputed.rs @@ -1,6 +1,7 @@ -use std::collections::HashMap; use std::sync::Arc; +use crate::hashmap::*; + use chrono::{DateTime, Utc}; use crate::eval::get_assignment; @@ -58,7 +59,7 @@ pub fn get_precomputed_configuration( ); None }) - .map(|assignment| ((flag_key.clone(), PrecomputedAssignment::from(assignment)))) + .map(|assignment| (flag_key.clone(), PrecomputedAssignment::from(assignment))) }) .collect::>(); @@ -137,7 +138,6 @@ pub fn get_precomputed_configuration( mod tests { use crate::Str; use chrono::Utc; - use std::collections::HashMap; use crate::{ eval::get_precomputed_configuration, ufc::UniversalFlagConfig, Configuration, @@ -145,6 +145,8 @@ mod tests { }; use std::{fs, sync::Arc}; + use crate::hashmap::*; + #[test] fn test_precomputed_assignment_basic() { let _ = env_logger::builder().is_test(true).try_init(); diff --git a/eppo_core/src/eval/eval_rules.rs b/eppo_core/src/eval/eval_rules.rs index 763246a1..78eaf301 100644 --- a/eppo_core/src/eval/eval_rules.rs +++ b/eppo_core/src/eval/eval_rules.rs @@ -81,7 +81,9 @@ impl ConditionCheck { #[cfg(test)] mod tests { - use std::{collections::HashMap, sync::Arc}; + use std::sync::Arc; + + use crate::hashmap::*; use crate::{ eval::{eval_visitor::NoopEvalVisitor, subject::Subject}, @@ -361,7 +363,11 @@ mod tests { &mut NoopEvalVisitor, &Subject::new( "key".into(), - Arc::new(HashMap::from([("age".into(), 11.0.into())])) + Arc::new({ + let mut map = HashMap::new(); + map.insert("age".into(), 11.0.into()); + map + }) ) )); } @@ -392,21 +398,33 @@ mod tests { &mut NoopEvalVisitor, &Subject::new( "key".into(), - Arc::new(HashMap::from([("age".into(), 20.0.into())])) + Arc::new({ + let mut map = HashMap::new(); + map.insert("age".into(), 20.0.into()); + map + }) ) )); assert!(!rule.eval( &mut NoopEvalVisitor, &Subject::new( "key".into(), - Arc::new(HashMap::from([("age".into(), 17.0.into())])) + Arc::new({ + let mut map = HashMap::new(); + map.insert("age".into(), 17.0.into()); + map + }) ) )); assert!(!rule.eval( &mut NoopEvalVisitor, &Subject::new( "key".into(), - Arc::new(HashMap::from([("age".into(), 110.0.into())])) + Arc::new({ + let mut map = HashMap::new(); + map.insert("age".into(), 110.0.into()); + map + }) ) )); } @@ -427,7 +445,11 @@ mod tests { &mut NoopEvalVisitor, &Subject::new( "key".into(), - Arc::new(HashMap::from([("name".into(), "alice".into())])) + Arc::new({ + let mut map = HashMap::new(); + map.insert("name".into(), "alice".into()); + map + }) ) )); } diff --git a/eppo_core/src/eval/evaluator.rs b/eppo_core/src/eval/evaluator.rs index 815ecff1..7a75252a 100644 --- a/eppo_core/src/eval/evaluator.rs +++ b/eppo_core/src/eval/evaluator.rs @@ -1,4 +1,6 @@ -use std::{collections::HashMap, sync::Arc}; +use std::sync::Arc; + +use crate::hashmap::HashMap; use chrono::Utc; diff --git a/eppo_core/src/events.rs b/eppo_core/src/events.rs index f1323d3f..5d1eda37 100644 --- a/eppo_core/src/events.rs +++ b/eppo_core/src/events.rs @@ -1,4 +1,6 @@ -use std::{collections::HashMap, sync::Arc}; +use std::sync::Arc; + +use crate::hashmap::HashMap; use serde::Serialize; diff --git a/eppo_core/src/hashmap.rs b/eppo_core/src/hashmap.rs new file mode 100644 index 00000000..7b09b70f --- /dev/null +++ b/eppo_core/src/hashmap.rs @@ -0,0 +1,5 @@ +#[cfg(feature = "ahash")] +pub use ahash::{HashMap, HashMapExt}; + +#[cfg(not(feature = "ahash"))] +pub use std::collections::HashMap; diff --git a/eppo_core/src/lib.rs b/eppo_core/src/lib.rs index 2a9faa8f..4966b703 100644 --- a/eppo_core/src/lib.rs +++ b/eppo_core/src/lib.rs @@ -49,6 +49,10 @@ #![warn(rustdoc::missing_crate_level_docs)] +// Re-export public dependencies. +#[cfg(feature = "ahash")] +pub use ahash; + pub mod attributes; pub mod background; pub mod bandits; @@ -67,6 +71,7 @@ pub mod ufc; mod configuration; mod error; +mod hashmap; mod obfuscation; mod precomputed; mod sdk_key; diff --git a/eppo_core/src/precomputed.rs b/eppo_core/src/precomputed.rs index 00c14ca4..df615151 100644 --- a/eppo_core/src/precomputed.rs +++ b/eppo_core/src/precomputed.rs @@ -1,6 +1,6 @@ -use std::collections::HashMap; use std::sync::Arc; +use crate::hashmap::HashMap; use base64::Engine; use rand::Rng; use serde::{Deserialize, Serialize}; @@ -198,6 +198,8 @@ impl From for ObfuscatedPrecomputedBandit { #[cfg(test)] mod tests { + use crate::hashmap::*; + use super::*; #[test] diff --git a/eppo_core/src/ufc/compiled_flag_config.rs b/eppo_core/src/ufc/compiled_flag_config.rs index c38bdd0d..5df7d5ef 100644 --- a/eppo_core/src/ufc/compiled_flag_config.rs +++ b/eppo_core/src/ufc/compiled_flag_config.rs @@ -1,4 +1,6 @@ -use std::{collections::HashMap, sync::Arc}; +use std::sync::Arc; + +use crate::hashmap::*; use serde::Serialize; diff --git a/eppo_core/src/ufc/models.rs b/eppo_core/src/ufc/models.rs index c0062cc6..dd06e4f1 100644 --- a/eppo_core/src/ufc/models.rs +++ b/eppo_core/src/ufc/models.rs @@ -1,5 +1,4 @@ -use std::collections::HashMap; - +use crate::hashmap::HashMap; use derive_more::From; use regex::Regex; use semver::Version; diff --git a/python-sdk/Cargo.toml b/python-sdk/Cargo.toml index 95824aaf..155b5123 100644 --- a/python-sdk/Cargo.toml +++ b/python-sdk/Cargo.toml @@ -8,7 +8,7 @@ publish = false crate-type = ["cdylib"] [dependencies] -eppo_core = { version = "=9.3.0", path = "../eppo_core", features = ["pyo3"] } +eppo_core = { version = "=9.3.0", path = "../eppo_core", features = ["pyo3", "ahash"] } log = "0.4.22" pyo3 = "0.27.2" pyo3-log = "0.13.2" diff --git a/python-sdk/src/client.rs b/python-sdk/src/client.rs index e39b59dd..0ea36fc2 100644 --- a/python-sdk/src/client.rs +++ b/python-sdk/src/client.rs @@ -1,5 +1,4 @@ use std::{ - collections::HashMap, ops::Deref, sync::{ atomic::{AtomicBool, Ordering}, @@ -17,6 +16,7 @@ use pyo3::{ }; use eppo_core::{ + ahash::HashMap, background::BackgroundThread, configuration_fetcher::ConfigurationFetcher, configuration_poller::{ diff --git a/ruby-sdk/Cargo.lock b/ruby-sdk/Cargo.lock index f1779bb7..43eb755e 100644 --- a/ruby-sdk/Cargo.lock +++ b/ruby-sdk/Cargo.lock @@ -2,6 +2,19 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.1", + "once_cell", + "version_check", + "zerocopy 0.8.31", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -113,6 +126,15 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -200,6 +222,16 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "darling" version = "0.20.10" @@ -264,6 +296,16 @@ dependencies = [ "syn", ] +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -311,28 +353,27 @@ dependencies = [ "env_logger", "eppo_core", "log", - "magnus 0.8.2", + "magnus", "rb-sys", "serde", "serde_json", - "serde_magnus 0.10.0", + "serde_magnus", "tokio", ] [[package]] name = "eppo_core" version = "9.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f7a2aa615d3a5848b8cd60921fe67290122054e3e51519cce8e024bd6107c8d" dependencies = [ + "ahash", "base64", "chrono", "derive_more", "exponential-backoff", "faststr", "log", - "magnus 0.7.1", - "md5", + "magnus", + "md-5", "rand 0.9.0", "regex", "reqwest", @@ -340,7 +381,7 @@ dependencies = [ "serde", "serde-bool", "serde_json", - "serde_magnus 0.9.0", + "serde_magnus", "serde_with", "thiserror", "tokio", @@ -498,6 +539,16 @@ dependencies = [ "slab", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -902,41 +953,18 @@ dependencies = [ "value-bag", ] -[[package]] -name = "magnus" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab" -dependencies = [ - "magnus-macros 0.6.0", - "rb-sys", - "rb-sys-env 0.1.2", - "seq-macro", -] - [[package]] name = "magnus" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012" dependencies = [ - "magnus-macros 0.8.0", + "magnus-macros", "rb-sys", - "rb-sys-env 0.2.2", + "rb-sys-env", "seq-macro", ] -[[package]] -name = "magnus-macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "magnus-macros" version = "0.8.0" @@ -949,10 +977,14 @@ dependencies = [ ] [[package]] -name = "md5" -version = "0.7.0" +name = "md-5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] [[package]] name = "memchr" @@ -1133,9 +1165,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -1159,7 +1191,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.0", - "zerocopy 0.8.15", + "zerocopy 0.8.31", ] [[package]] @@ -1198,7 +1230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff" dependencies = [ "getrandom 0.3.1", - "zerocopy 0.8.15", + "zerocopy 0.8.31", ] [[package]] @@ -1225,12 +1257,6 @@ dependencies = [ "syn", ] -[[package]] -name = "rb-sys-env" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb" - [[package]] name = "rb-sys-env" version = "0.2.2" @@ -1474,24 +1500,13 @@ dependencies = [ "zmij", ] -[[package]] -name = "serde_magnus" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b8b945a2dadb221f1c5490cfb411cab6c3821446b8eca50ee07e5a3893ec51" -dependencies = [ - "magnus 0.7.1", - "serde", - "tap", -] - [[package]] name = "serde_magnus" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a5121544138e6a14036e48ecbe589fb63577f35620caaa32642257b412c317" dependencies = [ - "magnus 0.8.2", + "magnus", "serde", "tap", ] @@ -1874,6 +1889,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + [[package]] name = "unicode-ident" version = "1.0.14" @@ -1961,6 +1982,12 @@ dependencies = [ "sval_serde", ] +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + [[package]] name = "want" version = "0.3.1" @@ -2363,11 +2390,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.15" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e101d4bc320b6f9abb68846837b70e25e380ca2f467ab494bf29fcc435fcc3" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ - "zerocopy-derive 0.8.15", + "zerocopy-derive 0.8.31", ] [[package]] @@ -2383,9 +2410,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.15" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a73df1008145cd135b3c780d275c57c3e6ba8324a41bd5e0008fe167c3bc7c" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", diff --git a/ruby-sdk/ext/eppo_client/Cargo.toml b/ruby-sdk/ext/eppo_client/Cargo.toml index ffca0fdb..44be90b4 100644 --- a/ruby-sdk/ext/eppo_client/Cargo.toml +++ b/ruby-sdk/ext/eppo_client/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib"] [dependencies] env_logger = { version = "0.11.3", features = ["unstable-kv"] } -eppo_core = { version = "=9.3.0", features = ["magnus", "event_ingestion"] } +eppo_core = { version = "=9.3.0", features = ["magnus", "event_ingestion", "ahash"] } log = { version = "0.4.29", features = ["kv_serde"] } magnus = { version = "0.8.2" } serde = { version = "1.0.203", features = ["derive"] } diff --git a/rust-sdk/examples/assignment_details/main.rs b/rust-sdk/examples/assignment_details/main.rs index d3e6cfd7..df786628 100644 --- a/rust-sdk/examples/assignment_details/main.rs +++ b/rust-sdk/examples/assignment_details/main.rs @@ -27,7 +27,11 @@ pub fn main() -> eppo::Result<()> { let assignment_with_details = client.get_boolean_assignment_details( "a-boolean-flag", &"test-subject".into(), - &Arc::new([("name".into(), AttributeValue::from(""))].into()), + &Arc::new( + [("name".into(), AttributeValue::from(""))] + .into_iter() + .collect(), + ), ); println!( diff --git a/rust-sdk/examples/simple/main.rs b/rust-sdk/examples/simple/main.rs index 9a80db8f..bbb39a74 100644 --- a/rust-sdk/examples/simple/main.rs +++ b/rust-sdk/examples/simple/main.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, time::Duration}; +use std::time::Duration; pub fn main() -> eppo::Result<()> { // Configure env_logger to see Eppo SDK logs. @@ -26,7 +26,7 @@ pub fn main() -> eppo::Result<()> { .get_boolean_assignment( "a-boolean-flag", &"test-subject".into(), - &HashMap::new().into(), + &Default::default(), ) .unwrap_or_default() // default assignment diff --git a/rust-sdk/src/client.rs b/rust-sdk/src/client.rs index 183c941a..1705a353 100644 --- a/rust-sdk/src/client.rs +++ b/rust-sdk/src/client.rs @@ -543,7 +543,7 @@ impl<'a> Client<'a> { #[cfg(test)] mod tests { - use std::{collections::HashMap, sync::Arc}; + use std::sync::Arc; use crate::{Client, ClientConfig}; use eppo_core::configuration_store::ConfigurationStore; @@ -558,7 +558,7 @@ mod tests { assert_eq!( client - .get_assignment("flag", &"subject".into(), &Arc::new(HashMap::new())) + .get_assignment("flag", &"subject".into(), &Default::default()) .unwrap(), None );