jamesmunns / postcard

A no_std + serde compatible message library for Rust
Apache License 2.0
945 stars 92 forks source link

Optimize Varint encoding #60

Closed bugadani closed 2 years ago

bugadani commented 2 years ago

This PR optimizes the varint_* functions to avoid an unnecessary bit masking.

The idea behind this PR is the following:

Assuming I'm not catastrophically wrong, the resulting code optimizes slightly better: https://rust.godbolt.org/z/8dz48vocx

netlify[bot] commented 2 years ago

Deploy Preview for cute-starship-2d9c9b ready!

Name Link
Latest commit 09b00c85a4b5ef1b124fc433775d2ba542478a86
Latest deploy log https://app.netlify.com/sites/cute-starship-2d9c9b/deploys/62b0958843924f0008744cc1
Deploy Preview https://deploy-preview-60--cute-starship-2d9c9b.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

jamesmunns commented 2 years ago

Looks great, thanks!