Introduce Cargo workspace in prep for schema
This commit is contained in:
parent
b4d7af4322
commit
825d208198
|
@ -1,25 +1,4 @@
|
|||
[package]
|
||||
name = "preserves"
|
||||
version = "0.12.0"
|
||||
authors = ["Tony Garnock-Jones <tonyg@leastfixedpoint.com>"]
|
||||
edition = "2018"
|
||||
description = "Implementation of the Preserves serialization format via serde."
|
||||
homepage = "https://preserves.gitlab.io/"
|
||||
repository = "https://gitlab.com/preserves/preserves"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[badges]
|
||||
gitlab = { repository = "preserves/preserves" }
|
||||
|
||||
[dependencies]
|
||||
num = "0.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_bytes = "0.11"
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3"
|
||||
|
||||
[[bench]]
|
||||
name = "codec"
|
||||
harness = false
|
||||
[workspace]
|
||||
members = [
|
||||
"preserves",
|
||||
]
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
”‚uApple‚vColourSred‚uApple‚vColourUgreen„vBanana‚ykilograms?¾¸Që…¸‚vColourXbrownish5‚tPear<61>zConference
|
|
@ -1 +0,0 @@
|
|||
浮uAppleWColourSred「PeachVAppleWColourUgreen<EFBFBD>BananaZkilograms?セクQ<EFBDB8>クWColourXbrownish5イxripeness『SquishyUPear】Conference
|
|
@ -0,0 +1,25 @@
|
|||
[package]
|
||||
name = "preserves"
|
||||
version = "0.12.0"
|
||||
authors = ["Tony Garnock-Jones <tonyg@leastfixedpoint.com>"]
|
||||
edition = "2018"
|
||||
description = "Implementation of the Preserves serialization format via serde."
|
||||
homepage = "https://preserves.gitlab.io/"
|
||||
repository = "https://gitlab.com/preserves/preserves"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[badges]
|
||||
gitlab = { repository = "preserves/preserves" }
|
||||
|
||||
[dependencies]
|
||||
num = "0.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_bytes = "0.11"
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3"
|
||||
|
||||
[[bench]]
|
||||
name = "codec"
|
||||
harness = false
|
|
@ -10,7 +10,7 @@ mod samples;
|
|||
use samples::TestCases;
|
||||
|
||||
pub fn bench_decoder_bytes(c: &mut Criterion) {
|
||||
let mut fh = std::fs::File::open("../../tests/samples.bin").unwrap();
|
||||
let mut fh = std::fs::File::open("../../../tests/samples.bin").unwrap();
|
||||
let mut bs = vec![];
|
||||
fh.read_to_end(&mut bs).ok();
|
||||
c.bench_function("decode samples.bin via bytes", |b| b.iter_with_large_drop(
|
||||
|
@ -18,7 +18,7 @@ pub fn bench_decoder_bytes(c: &mut Criterion) {
|
|||
}
|
||||
|
||||
pub fn bench_decoder_file(c: &mut Criterion) {
|
||||
let mut fh = std::fs::File::open("../../tests/samples.bin").unwrap();
|
||||
let mut fh = std::fs::File::open("../../../tests/samples.bin").unwrap();
|
||||
c.bench_function("decode samples.bin via file", |b| b.iter_with_large_drop(|| {
|
||||
fh.seek(SeekFrom::Start(0)).ok();
|
||||
PackedReader::decode_read(&mut fh).demand_next(true).unwrap()
|
||||
|
@ -26,7 +26,7 @@ pub fn bench_decoder_file(c: &mut Criterion) {
|
|||
}
|
||||
|
||||
pub fn bench_decoder_buffered_file(c: &mut Criterion) {
|
||||
let mut fh = BufReader::new(std::fs::File::open("../../tests/samples.bin").unwrap());
|
||||
let mut fh = BufReader::new(std::fs::File::open("../../../tests/samples.bin").unwrap());
|
||||
c.bench_function("decode samples.bin via buffered file", |b| b.iter_with_large_drop(|| {
|
||||
fh.seek(SeekFrom::Start(0)).ok();
|
||||
PackedReader::decode_read(&mut fh).demand_next(true).unwrap()
|
||||
|
@ -34,7 +34,7 @@ pub fn bench_decoder_buffered_file(c: &mut Criterion) {
|
|||
}
|
||||
|
||||
pub fn bench_encoder(c: &mut Criterion) {
|
||||
let mut fh = std::fs::File::open("../../tests/samples.bin").unwrap();
|
||||
let mut fh = std::fs::File::open("../../../tests/samples.bin").unwrap();
|
||||
let v = PackedReader::decode_read(&mut fh).demand_next(true).unwrap();
|
||||
c.bench_function("encode samples.bin", |b| b.iter_with_large_drop(|| {
|
||||
let mut bs = vec![];
|
||||
|
@ -44,7 +44,7 @@ pub fn bench_encoder(c: &mut Criterion) {
|
|||
}
|
||||
|
||||
pub fn bench_de(c: &mut Criterion) {
|
||||
let mut fh = std::fs::File::open("../../tests/samples.bin").unwrap();
|
||||
let mut fh = std::fs::File::open("../../../tests/samples.bin").unwrap();
|
||||
let mut bs = vec![];
|
||||
fh.read_to_end(&mut bs).ok();
|
||||
c.bench_function("deserialize samples.bin", |b| b.iter_with_large_drop(
|
||||
|
@ -52,7 +52,7 @@ pub fn bench_de(c: &mut Criterion) {
|
|||
}
|
||||
|
||||
pub fn bench_ser(c: &mut Criterion) {
|
||||
let mut fh = std::fs::File::open("../../tests/samples.bin").unwrap();
|
||||
let mut fh = std::fs::File::open("../../../tests/samples.bin").unwrap();
|
||||
let v: TestCases = de::from_read(&mut fh).unwrap();
|
||||
c.bench_function("serialize samples.bin", |b| b.iter_with_large_drop(|| {
|
||||
let mut bs = vec![];
|
||||
|
@ -62,7 +62,7 @@ pub fn bench_ser(c: &mut Criterion) {
|
|||
}
|
||||
|
||||
pub fn bench_decoder_de(c: &mut Criterion) {
|
||||
let mut fh = std::fs::File::open("../../tests/samples.bin").unwrap();
|
||||
let mut fh = std::fs::File::open("../../../tests/samples.bin").unwrap();
|
||||
let mut bs = vec![];
|
||||
fh.read_to_end(&mut bs).ok();
|
||||
c.bench_function("decode-then-deserialize samples.bin", |b| b.iter_with_large_drop(
|
||||
|
@ -70,7 +70,7 @@ pub fn bench_decoder_de(c: &mut Criterion) {
|
|||
}
|
||||
|
||||
pub fn bench_ser_encoder(c: &mut Criterion) {
|
||||
let mut fh = std::fs::File::open("../../tests/samples.bin").unwrap();
|
||||
let mut fh = std::fs::File::open("../../../tests/samples.bin").unwrap();
|
||||
let v: TestCases = de::from_read(&mut fh).unwrap();
|
||||
c.bench_function("serialize-then-encode samples.bin", |b| b.iter_with_large_drop(|| {
|
||||
let mut bs = vec![];
|
|
@ -3,7 +3,7 @@ BINARY_FILES=known-data.bin unknown-data.bin
|
|||
all: $(BINARY_FILES)
|
||||
|
||||
%.bin: %.txt Makefile
|
||||
racket ../../racket/preserves/preserves/tool.rkt --atob --no-annotations < $< > $@.tmp || (rm -f $@.tmp; false)
|
||||
racket ../../../racket/preserves/preserves/tool.rkt --atob --no-annotations < $< > $@.tmp || (rm -f $@.tmp; false)
|
||||
mv $@.tmp $@
|
||||
|
||||
clean:
|
|
@ -0,0 +1,2 @@
|
|||
µ´³Apple´³Colour±red„„´³Apple´³Colour±green„„´³Banana´³ kilogramsƒ?¾¸Që…¸„´³Colour±brownish„•„´³Pear´³
|
||||
Conference„„„
|
|
@ -0,0 +1,2 @@
|
|||
µ´³Apple´³Colour±red„„´³Peach„´³Apple´³Colour±green„„´³Banana´³ kilogramsƒ?¾¸Që…¸„´³Colour±brownish„•·³ripeness´³Squishy„„„´³Pear´³
|
||||
Conference„„„
|
|
@ -15,7 +15,7 @@ fn decode_all(bytes: &'_ [u8]) -> Result<Vec<IOValue>, std::io::Error> {
|
|||
}
|
||||
|
||||
#[test] fn run() -> std::io::Result<()> {
|
||||
let mut fh = std::fs::File::open("../../tests/samples.bin").unwrap();
|
||||
let mut fh = std::fs::File::open("../../../tests/samples.bin").unwrap();
|
||||
let mut d = PackedReader::decode_read(&mut fh).configured(true);
|
||||
let tests: TestCases = deserialize_from_value(&d.next().unwrap().unwrap()).unwrap();
|
||||
// println!("{:#?}", tests);
|
Loading…
Reference in New Issue