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/bytes/benches/bytes.rs | |
| 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/bytes/benches/bytes.rs')
| -rw-r--r-- | vendor/bytes/benches/bytes.rs | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/vendor/bytes/benches/bytes.rs b/vendor/bytes/benches/bytes.rs deleted file mode 100644 index 8782d006..00000000 --- a/vendor/bytes/benches/bytes.rs +++ /dev/null @@ -1,120 +0,0 @@ -#![feature(test)] -#![warn(rust_2018_idioms)] - -extern crate test; - -use bytes::Bytes; -use test::Bencher; - -#[bench] -fn deref_unique(b: &mut Bencher) { - let buf = Bytes::from(vec![0; 1024]); - - b.iter(|| { - for _ in 0..1024 { - test::black_box(&buf[..]); - } - }) -} - -#[bench] -fn deref_shared(b: &mut Bencher) { - let buf = Bytes::from(vec![0; 1024]); - let _b2 = buf.clone(); - - b.iter(|| { - for _ in 0..1024 { - test::black_box(&buf[..]); - } - }) -} - -#[bench] -fn deref_static(b: &mut Bencher) { - let buf = Bytes::from_static(b"hello world"); - - b.iter(|| { - for _ in 0..1024 { - test::black_box(&buf[..]); - } - }) -} - -#[bench] -fn clone_static(b: &mut Bencher) { - let bytes = - Bytes::from_static("hello world 1234567890 and have a good byte 0987654321".as_bytes()); - - b.iter(|| { - for _ in 0..1024 { - test::black_box(test::black_box(&bytes).clone()); - } - }) -} - -#[bench] -fn clone_shared(b: &mut Bencher) { - let bytes = Bytes::from(b"hello world 1234567890 and have a good byte 0987654321".to_vec()); - - b.iter(|| { - for _ in 0..1024 { - test::black_box(test::black_box(&bytes).clone()); - } - }) -} - -#[bench] -fn clone_arc_vec(b: &mut Bencher) { - use std::sync::Arc; - let bytes = Arc::new(b"hello world 1234567890 and have a good byte 0987654321".to_vec()); - - b.iter(|| { - for _ in 0..1024 { - test::black_box(test::black_box(&bytes).clone()); - } - }) -} - -#[bench] -fn from_long_slice(b: &mut Bencher) { - let data = [0u8; 128]; - b.bytes = data.len() as u64; - b.iter(|| { - let buf = Bytes::copy_from_slice(&data[..]); - test::black_box(buf); - }) -} - -#[bench] -fn slice_empty(b: &mut Bencher) { - b.iter(|| { - // `clone` is to convert to ARC - let b = Bytes::from(vec![17; 1024]).clone(); - for i in 0..1000 { - test::black_box(b.slice(i % 100..i % 100)); - } - }) -} - -#[bench] -fn slice_short_from_arc(b: &mut Bencher) { - b.iter(|| { - // `clone` is to convert to ARC - let b = Bytes::from(vec![17; 1024]).clone(); - for i in 0..1000 { - test::black_box(b.slice(1..2 + i % 10)); - } - }) -} - -#[bench] -fn split_off_and_drop(b: &mut Bencher) { - b.iter(|| { - for _ in 0..1024 { - let v = vec![10; 200]; - let mut b = Bytes::from(v); - test::black_box(b.split_off(100)); - test::black_box(b); - } - }) -} |
