Giter Site home page Giter Site logo

Comments (2)

clwi avatar clwi commented on September 1, 2024

Thank you for your interest in CWPack.

Your proposal is, although very appealing, not possible to implement because one of the features in MessagePack is that as little space as possible is used. E.g. an integer can occupy anything from 1 to 9 bytes depending on the integer.

Instead I would recommend you to look at dynamic_memory_pack_context defined in goodies/basic-contexts/basic-contexts.h which is especially created to handle this problem.

/Claes

from cwpack.

mczarnek avatar mczarnek commented on September 1, 2024

Thanks Claes. That's a reasonable way to handle it. Personally would be happy if there was such a function that popped out the max size that the Message Pack might be, so that way only one malloc is needed, which is likely higher performance. But as currently, once built, you can determine how large it is. I also suppose this is one reason passing in a struct to compress is nice, behind the scenes you could calculate exactly how much is needed, allocate it then pack it.

Still very useful if memory is cheaper short term than it is once you need to use it, which it typically is. MessagePack is very valuable for storage or networking, but short term.. I'm fine allocating a few extra bytes and value performance.

from cwpack.

Related Issues (11)

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.