feat: with envelope tests
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
795d009cd0
commit
d4d5374392
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -729,6 +729,13 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "test-bin"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"crunch-envelope",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "textwrap"
|
name = "textwrap"
|
||||||
version = "0.16.0"
|
version = "0.16.0"
|
||||||
|
@ -9,6 +9,9 @@ edition = "2021"
|
|||||||
name = "envelope_benchmark"
|
name = "envelope_benchmark"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
[profile.bench]
|
||||||
|
debug = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["json"]
|
default = ["json"]
|
||||||
json = ["dep:serde", "dep:serde_json", "dep:base64"]
|
json = ["dep:serde", "dep:serde_json", "dep:base64"]
|
||||||
|
9
crates/test-bin/Cargo.toml
Normal file
9
crates/test-bin/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "test-bin"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
crunch-envelope.workspace = true
|
27
crates/test-bin/src/main.rs
Normal file
27
crates/test-bin/src/main.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
fn main() {
|
||||||
|
#[no_mangle]
|
||||||
|
fn envelope_capnp_benchmark(content: &[u8]) -> () {
|
||||||
|
let out = crunch_envelope::wrap("some-domain", "some-entity", content);
|
||||||
|
|
||||||
|
let out = crunch_envelope::unwrap(&out).expect("to be able to unwrap capnp message");
|
||||||
|
|
||||||
|
println!("{:?}", out.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
fn envelope_json_benchmark(content: &[u8]) -> () {
|
||||||
|
let out = crunch_envelope::json::wrap("some-domain", "some-entity", content);
|
||||||
|
|
||||||
|
let out = crunch_envelope::json::unwrap(&out).expect("to be able to unwrap capnp message");
|
||||||
|
|
||||||
|
println!("{:?}", out.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
let large_content: [u8; 1000000] = [0; 1000000];
|
||||||
|
|
||||||
|
_ = envelope_capnp_benchmark(&large_content);
|
||||||
|
|
||||||
|
_ = envelope_json_benchmark(&large_content);
|
||||||
|
|
||||||
|
println!("done")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user