Comments (2)
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.
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)
- Writing directly to pack buffer HOT 4
- Example is not working! HOT 2
- aliasing violations
- typo in cw_unpack_next_str_lengh() and cw_unpack_next_bin_lengh()
- CMake support & version tag
- cwpack.c:788:43: warning: comparison is always false due to limited range of data type [-Wtype-limits]
- Support for null terminated strings. HOT 1
- Unaligned access with 64-bit data on M4 HOT 3
- Feature request: C89 compatible version HOT 5
- highlight CMP library version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cwpack.