Skip to content

Serialize entire frozen hashmap to bytes#2403

Merged
coolreader18 merged 1 commit into
masterfrom
coolreader18/bincode-libmap
Jan 29, 2021
Merged

Serialize entire frozen hashmap to bytes#2403
coolreader18 merged 1 commit into
masterfrom
coolreader18/bincode-libmap

Conversation

@coolreader18
Copy link
Copy Markdown
Member

@coolreader18 coolreader18 commented Jan 20, 2021

So instead of hashmap! { "a" => decode(b"....."), "b" => decode(b"......") }, it's just decode(b"<map>")

release binary sizes:

default freeze-stdlib
master 18296 29908
libmap 18292 24832

My hunch on this was that putting all the data in the same buffer gives lz4 more opportunity to deduplicate, and I'm pretty sure that's what made the difference in binary size.

@coolreader18 coolreader18 force-pushed the coolreader18/bincode-libmap branch 2 times, most recently from d619f9f to f89a8fa Compare January 20, 2021 00:39
Comment thread bytecode/src/lib.rs Outdated
use super::*;
use bincode::{options, Options};
use std::convert::TryInto;
use std::io::{self};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not just std::io?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, nice catch :)

@coolreader18 coolreader18 force-pushed the coolreader18/bincode-libmap branch from f89a8fa to 58503cb Compare January 29, 2021 06:46
@coolreader18 coolreader18 merged commit da63324 into master Jan 29, 2021
@coolreader18 coolreader18 deleted the coolreader18/bincode-libmap branch January 29, 2021 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants