Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msgpack optimization. #1131

Open
MrCoInSanity opened this issue Jun 30, 2024 · 0 comments
Open

msgpack optimization. #1131

MrCoInSanity opened this issue Jun 30, 2024 · 0 comments

Comments

@MrCoInSanity
Copy link

So, first of all, thank you for making such a great library. I was wondering if you could give me your feedback on how I'm packing my data. I feel like there is a more efficient way to do it. My goal is pack the data as fast as possible because this is getting sent to a renderer. Here is my code below, I appreciate any feedback.

 for (const auto& data : dataVector) {
     msgpack_pack_array(pk, 2);  // Pack each pair in an inner array
     msgpack_pack_int(pk, static_cast<int>(data.type));

     switch (data.type) {
     case TYPE_Point:
    msgpack_pack_array(pk, 7);
    msgpack_pack_unsigned_short(pk, data.pointData.x);
    msgpack_pack_unsigned_short(pk, data.pointData.y);
    msgpack_pack_unsigned_short(pk, data.pointData.size);
    msgpack_pack_unsigned_char(pk, data.pointData.thickness);
    msgpack_pack_unsigned_char(pk, data.pointData.r);
    msgpack_pack_unsigned_char(pk, data.pointData.g);
    msgpack_pack_unsigned_char(pk, data.pointData.b);
    break;
    //more case statements
    }
}
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant