Skip to content

Commit

Permalink
Adjust to crate rename
Browse files Browse the repository at this point in the history
  • Loading branch information
FlixCoder committed Sep 28, 2024
1 parent 128e2fb commit 4b38297
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 57 deletions.
87 changes: 48 additions & 39 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[workspace]
members = [
"pages",
"tools/bencher",
"tools/formatter",
"tools/parser",
"tools/schema",
"pages",
"tools/bencher",
"tools/formatter",
"tools/parser",
"tools/schema",
]

[workspace.package]
Expand Down Expand Up @@ -49,9 +49,14 @@ bincode1 = { package = "bincode", version = "=1.3.3", optional = true }
bincode = { package = "bincode", version = "=2.0.0-rc.3", optional = true }
bitcode = { version = "=0.6.3", optional = true }
borsh = { version = "=1.5.1", features = ["derive"], optional = true }
brief = { version = "=0.1.0", features = ["std"], optional = true, path = "../brief" }
serde-brief = { version = "=0.1.0", features = [
"std",
], optional = true }
capnp = { version = "=0.19.7", optional = true }
cbor4ii = { version = "=0.3.3", features = [ "use_std", "serde1" ], optional = true }
cbor4ii = { version = "=0.3.3", features = [
"use_std",
"serde1",
], optional = true }
ciborium = { version = "=0.2.2", optional = true }
criterion = "=0.5.1"
databuf = { version = "=0.5.0", optional = true }
Expand All @@ -60,8 +65,10 @@ flatbuffers = { version = "=24.3.25", optional = true }
libflate = "=2.1.0"
msgpacker = { version = "=0.4.3", optional = true }
nachricht-serde = { version = "=0.4.0", optional = true }
nanoserde = {version = "=0.1.37", optional = true }
parity-scale-codec = { version = "=3.6.12", features = ["full"], optional = true }
nanoserde = { version = "=0.1.37", optional = true }
parity-scale-codec = { version = "=3.6.12", features = [
"full",
], optional = true }
parity-scale-codec-derive = { version = "=3.6.12", optional = true }
postcard = { version = "=1.0.10", features = ["alloc"], optional = true }
pot = { version = "=3.0.1", optional = true }
Expand All @@ -74,7 +81,9 @@ ron = { version = "=0.8.1", optional = true }
serde = { version = "=1.0.210", features = ["derive"] }
serde_bare = { version = "=0.5.0", optional = true }
serde_cbor = { version = "=0.11.2", optional = true }
serde_json = { version = "=1.0.128", features = ["float_roundtrip"], optional = true }
serde_json = { version = "=1.0.128", features = [
"float_roundtrip",
], optional = true }
simd-json = { version = "=0.13.10", optional = true }
simd-json-derive = { version = "=0.13.0", optional = true }
speedy = { version = "=0.8.7", optional = true }
Expand All @@ -85,35 +94,35 @@ zstd = "=0.13.2"

[features]
default = [
"bilrost",
"bincode1",
"bincode",
"bitcode",
"borsh",
"brief",
"capnp",
"cbor4ii",
"ciborium",
"databuf",
"dlhn",
"flatbuffers",
"msgpacker",
"nachricht-serde",
"nanoserde",
"scale",
"postcard",
"pot",
"prost",
"rkyv",
"rmp-serde",
"ron",
"serde_bare",
"serde_cbor",
"serde_json",
"simd-json",
"speedy",
"savefile",
"wiring"
"bilrost",
"bincode1",
"bincode",
"bitcode",
"borsh",
"serde-brief",
"capnp",
"cbor4ii",
"ciborium",
"databuf",
"dlhn",
"flatbuffers",
"msgpacker",
"nachricht-serde",
"nanoserde",
"scale",
"postcard",
"pot",
"prost",
"rkyv",
"rmp-serde",
"ron",
"serde_bare",
"serde_cbor",
"serde_json",
"simd-json",
"speedy",
"savefile",
"wiring",
]
capnp = ["dep:capnp"]
prost = ["dep:capnp", "dep:prost"]
Expand Down
20 changes: 10 additions & 10 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use rust_serialization_benchmark::bench_bincode1;
use rust_serialization_benchmark::bench_bitcode;
#[cfg(feature = "borsh")]
use rust_serialization_benchmark::bench_borsh;
#[cfg(feature = "brief")]
use rust_serialization_benchmark::bench_brief;
#[cfg(feature = "serde-brief")]
use rust_serialization_benchmark::bench_serde_brief;
#[cfg(feature = "capnp")]
use rust_serialization_benchmark::bench_capnp;
#[cfg(feature = "cbor4ii")]
Expand Down Expand Up @@ -93,8 +93,8 @@ fn bench_log(c: &mut Criterion) {
#[cfg(feature = "borsh")]
bench_borsh::bench(BENCH, c, &data);

#[cfg(feature = "brief")]
bench_brief::bench(BENCH, c, &data);
#[cfg(feature = "serde-brief")]
bench_serde_brief::bench(BENCH, c, &data);

#[cfg(feature = "capnp")]
bench_capnp::bench(BENCH, c, &data, |bytes| {
Expand Down Expand Up @@ -273,8 +273,8 @@ fn bench_mesh(c: &mut Criterion) {
#[cfg(feature = "borsh")]
bench_borsh::bench(BENCH, c, &data);

#[cfg(feature = "brief")]
bench_brief::bench(BENCH, c, &data);
#[cfg(feature = "serde-brief")]
bench_serde_brief::bench(BENCH, c, &data);

#[cfg(feature = "capnp")]
bench_capnp::bench(BENCH, c, &data, |bytes| {
Expand Down Expand Up @@ -440,8 +440,8 @@ fn bench_minecraft_savedata(c: &mut Criterion) {
#[cfg(feature = "borsh")]
bench_borsh::bench(BENCH, c, &data);

#[cfg(feature = "brief")]
bench_brief::bench(BENCH, c, &data);
#[cfg(feature = "serde-brief")]
bench_serde_brief::bench(BENCH, c, &data);

#[cfg(feature = "capnp")]
bench_capnp::bench(BENCH, c, &data, |bytes| {
Expand Down Expand Up @@ -610,8 +610,8 @@ fn bench_mk48(c: &mut Criterion) {
#[cfg(feature = "borsh")]
bench_borsh::bench(BENCH, c, &data);

#[cfg(feature = "brief")]
bench_brief::bench(BENCH, c, &data);
#[cfg(feature = "serde-brief")]
bench_serde_brief::bench(BENCH, c, &data);

#[cfg(feature = "capnp")]
bench_capnp::bench(BENCH, c, &data, |bytes| {
Expand Down
12 changes: 6 additions & 6 deletions src/bench_brief.rs → src/bench_serde_brief.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ where
{
const BUFFER_LEN: usize = 50_000_000;

let mut group = c.benchmark_group(format!("{}/brief", name));
let mut group = c.benchmark_group(format!("{}/serde-brief", name));

let mut serialize_buffer = vec![0; BUFFER_LEN];
group.bench_function("serialize", |b| {
b.iter(|| {
black_box(
brief::to_slice(black_box(&data), black_box(serialize_buffer.as_mut_slice()))
serde_brief::to_slice(black_box(&data), black_box(serialize_buffer.as_mut_slice()))
.unwrap(),
);
})
});

let deserialize_buffer = brief::to_vec(&data).unwrap();
let deserialize_buffer = serde_brief::to_vec(&data).unwrap();

group.bench_function("deserialize", |b| {
b.iter(|| {
black_box(brief::from_slice::<'_, T>(black_box(&deserialize_buffer)).unwrap());
black_box(serde_brief::from_slice::<'_, T>(black_box(&deserialize_buffer)).unwrap());
})
});

crate::bench_size(name, "brief", deserialize_buffer.as_slice());
crate::bench_size(name, "serde-brief", deserialize_buffer.as_slice());

assert!(brief::from_slice::<T>(&deserialize_buffer).unwrap() == *data);
assert!(serde_brief::from_slice::<T>(&deserialize_buffer).unwrap() == *data);

group.finish();
}
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub mod bench_bincode1;
pub mod bench_bitcode;
#[cfg(feature = "borsh")]
pub mod bench_borsh;
#[cfg(feature = "brief")]
pub mod bench_brief;
#[cfg(feature = "serde-brief")]
pub mod bench_serde_brief;
#[cfg(feature = "capnp")]
pub mod bench_capnp;
#[cfg(feature = "cbor4ii")]
Expand Down

0 comments on commit 4b38297

Please sign in to comment.