Code Monkey home page Code Monkey logo

Comments (8)

summraznboi avatar summraznboi commented on August 15, 2024 1

I am a large proponent of VLQ, it matches the UTF-8 endianness, and is used a lot everywhere.

from runestone.

revofusion avatar revofusion commented on August 15, 2024 1

Here is my JS/TS implementation of PrefixVarint: https://gist.github.com/revofusion/ba74dc11e0b007feba84b7b492e5ee87

Similar rust implementation at: https://github.com/otake84/dlhn/blob/22ce82ab3740328ff7041b63f77ee70020605b1c/dlhn/src/prefix_varint.rs#L5

from runestone.

casey avatar casey commented on August 15, 2024 1

I'm writing a prefix varint implementation that supports u128. Prefix varints are nice, fast, and compact, but they are quite tricky, so implementation complexity is a downside.

from runestone.

summraznboi avatar summraznboi commented on August 15, 2024

@revofusion the only problem I have for this implementation is that it only supports max_uint64, when we need to support at least max_uint128 for transfer amount. I would be ok with a generic prefix varint impl that doesn’t stop at any integer size limit.

from runestone.

summraznboi avatar summraznboi commented on August 15, 2024

Please provide a high level overview of your prefix varint for u128 when you get a chance so those interested can provide any feedback or gain consensus, especially since the runestone is essentially a lot of varints.

from runestone.

casey avatar casey commented on August 15, 2024

I've been fooling around with u128 varints, and found them very complex, and no more compact than LEB128 and VLQ. (I thought that a 128 bit prefix varint could save 1 byte over LEB128, but it turns out that only works for a 64 bit prefix varint.)

I opened PR #24 implementing VLQ varints. It's still a draft, it only contains the varint implementation, and does not integrate it into the runestone encoder or decoder.

from runestone.

casey avatar casey commented on August 15, 2024

This is very dependent on the distribution of values. For example if we use deltas extensively, as in #9, then zero is likely to be a common value. We could use a varint implementation where zero is encoded as a single bit as an optimization.

from runestone.

casey avatar casey commented on August 15, 2024

Closing in favor of #53.

from runestone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.