Skip to content

Commit

Permalink
improve encode_varint performance by bounding its loop
Browse files Browse the repository at this point in the history
  • Loading branch information
mumbleskates committed Nov 13, 2023
1 parent 97cd4e2 commit 0790edf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn encode_varint<B>(mut value: u64, buf: &mut B)
where
B: BufMut,
{
loop {
for _ in 0..10 {
if value < 0x80 {
buf.put_u8(value as u8);
break;
Expand Down

0 comments on commit 0790edf

Please sign in to comment.