diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-15 16:37:08 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-17 16:30:22 -0600 |
| commit | 45df4d0d9b577fecee798d672695fe24ff57fb1b (patch) | |
| tree | 1b99bf645035b58e0d6db08c7a83521f41f7a75b /vendor/ryu/examples | |
| parent | f94f79608393d4ab127db63cc41668445ef6b243 (diff) | |
feat: migrate from Cedar to SpiceDB authorization system
This is a major architectural change that replaces the Cedar policy-based
authorization system with SpiceDB's relation-based authorization.
Key changes:
- Migrate from Rust to Go implementation
- Replace Cedar policies with SpiceDB schema and relationships
- Switch from envoy `ext_authz` with Cedar to SpiceDB permission checks
- Update build system and dependencies for Go ecosystem
- Maintain Envoy integration for external authorization
This change enables more flexible permission modeling through SpiceDB's
Google Zanzibar inspired relation-based system, supporting complex
hierarchical permissions that were difficult to express in Cedar.
Breaking change: Existing Cedar policies and Rust-based configuration
will no longer work and need to be migrated to SpiceDB schema.
Diffstat (limited to 'vendor/ryu/examples')
| -rw-r--r-- | vendor/ryu/examples/upstream_benchmark.rs | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/vendor/ryu/examples/upstream_benchmark.rs b/vendor/ryu/examples/upstream_benchmark.rs deleted file mode 100644 index 8de56ac8..00000000 --- a/vendor/ryu/examples/upstream_benchmark.rs +++ /dev/null @@ -1,85 +0,0 @@ -// cargo run --example upstream_benchmark --release - -use rand::{Rng, SeedableRng}; - -const SAMPLES: usize = 10000; -const ITERATIONS: usize = 1000; - -struct MeanAndVariance { - n: i64, - mean: f64, - m2: f64, -} - -impl MeanAndVariance { - fn new() -> Self { - MeanAndVariance { - n: 0, - mean: 0.0, - m2: 0.0, - } - } - - fn update(&mut self, x: f64) { - self.n += 1; - let d = x - self.mean; - self.mean += d / self.n as f64; - let d2 = x - self.mean; - self.m2 += d * d2; - } - - fn variance(&self) -> f64 { - self.m2 / (self.n - 1) as f64 - } - - fn stddev(&self) -> f64 { - self.variance().sqrt() - } -} - -macro_rules! benchmark { - ($name:ident, $ty:ident) => { - fn $name() -> usize { - let mut rng = rand_xorshift::XorShiftRng::from_seed([123u8; 16]); - let mut mv = MeanAndVariance::new(); - let mut throwaway = 0; - for _ in 0..SAMPLES { - let f = loop { - let f = $ty::from_bits(rng.random()); - if f.is_finite() { - break f; - } - }; - - let t1 = std::time::SystemTime::now(); - for _ in 0..ITERATIONS { - throwaway += ryu::Buffer::new().format_finite(f).len(); - } - let duration = t1.elapsed().unwrap(); - let nanos = duration.as_secs() * 1_000_000_000 + duration.subsec_nanos() as u64; - mv.update(nanos as f64 / ITERATIONS as f64); - } - println!( - "{:12} {:8.3} {:8.3}", - concat!(stringify!($name), ":"), - mv.mean, - mv.stddev(), - ); - throwaway - } - }; -} - -benchmark!(pretty32, f32); -benchmark!(pretty64, f64); - -fn main() { - println!("{:>20}{:>9}", "Average", "Stddev"); - let mut throwaway = 0; - throwaway += pretty32(); - throwaway += pretty64(); - if std::env::var_os("ryu-benchmark").is_some() { - // Prevent the compiler from optimizing the code away. - println!("{}", throwaway); - } -} |
