#byte #serialization #byte-buffer #peek #deserializing #byte-slice #poke

azul-peek-poke

用于将数据序列化和反序列化到/从字节缓冲区的一种机制,用于WebRender

1个不稳定版本

0.2.0 2021年7月11日

#984 in 编码

Download history 17/week @ 2024-01-01 15/week @ 2024-01-08 6/week @ 2024-02-12 23/week @ 2024-02-19 29/week @ 2024-02-26 14/week @ 2024-03-04 14/week @ 2024-03-11 10/week @ 2024-03-18 30/week @ 2024-03-25 35/week @ 2024-04-01 7/week @ 2024-04-08 8/week @ 2024-04-15

81每月下载量
2个crate中使用(通过azul-webrender-api

MIT/Apache

26KB
467

Peeks,Pokes和Pointers

从字节切片中Peek和Poke结构。

基准测试

以下是peek-pokebincode在序列化和反序列化相同的struct之间的比较基准测试结果

struct MyPeekPokeStruct {
    a: u8,
    b: u16,
    c: MyPeekPokeEnum,
    d: Option<usize>,
}

enum MyPeekPokeEnum {
    Variant1,
    Variant2(u16),
}
Benchmarking struct::serialize/peek_poke::poke_into: Collecting 100 samples in                                                                                struct::serialize/peek_poke::poke_into
                        time:   [2.7267 ns 2.7321 ns 2.7380 ns]

Benchmarking struct::serialize/bincode::serialize: Collecting 100 samples in est                                                                                struct::serialize/bincode::serialize
                        time:   [31.264 ns 31.326 ns 31.389 ns]

Benchmarking struct::deserialize/peek_poke::peek_from: Collecting 100 samples                                                                                 struct::deserialize/peek_poke::peek_from
                        time:   [5.3544 ns 5.3672 ns 5.3817 ns]

Benchmarking struct::deserialize/bincode::deserialize: Collecting 100 samples in                                                                                struct::deserialize/bincode::deserialize
                        time:   [25.155 ns 26.439 ns 27.661 ns]

你可以通过运行以下命令来运行基准测试

cargo bench

许可证

在以下许可证中选择一项:

由你选择。

有关详细信息,请参阅LICENSE-APACHELICENSE-MIT

贡献

除非你明确声明,否则根据Apache-2.0许可证定义的,你提交的任何有意包含在工作中的贡献都将双重许可,不附加任何额外条款或条件。

依赖项

~0–370KB