b-inary / postflop-solver

[Development suspended] An efficient open-source postflop solver library written in Rust
GNU Affero General Public License v3.0
246 stars 97 forks source link

Extremely slow serialization with bincode v2 #40

Closed mhluska closed 1 year ago

mhluska commented 1 year ago

I'm noticing throughput of several MB per second when saving to file with some solutions (others work fine, yet others are slow at the beginning and fast towards the end of serialization). I'm using high end EC2 machines so it's unlikely to be a hardware limitation. I also have compression disabled.

I'm pretty sure the issue is the bincode v2 dependency: https://github.com/bincode-org/bincode/issues/618

When I add this to the Cargo.toml file, things serialize much faster:

[profile.release]
lto = true
b-inary commented 1 year ago

Thank you for the comment. In general, LTO sometimes makes things dramatically faster, but sometimes it makes things worse. To understand why, we need to dive deep into Rust's complex build system.

I don't think there is much I can do here. Maybe we can switch to a different serialization library, but I think bincode is a very popular and reasonable library for our use case.