CosmicHorrorDev / vdf-rs

VDF parsing and (de)serialization for Rust
Apache License 2.0
31 stars 3 forks source link

Maybe switch to owned types for parser #21

Closed CosmicHorrorDev closed 3 years ago

CosmicHorrorDev commented 3 years ago

Currently the parser returns types based on the lifetime of the pre-parsed text. This allows for better possible performance along with possibly reducing memory consumption (I think). On the other hand though it makes parsing more complicated, and dealing with the loosely typed representation more complicated.

I think it's worth switching to owned types just to make things simpler and more ergonomic. If I was going for absolute best speed, then it would be nice to use references, but there are already other choices (like pest) where ergonomics has been picked over raw speed

CosmicHorrorDev commented 3 years ago

An experimental switch to owned types resulted in a ~40% regression in parsing time so I'm going to currently leave the library as is due to the large performance difference.