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-CXX depends on boost making it one of the slowest to compile binary serialization methods #1000

Closed
wbehrens-on-gh opened this issue Feb 5, 2022 · 8 comments

Comments

@wbehrens-on-gh
Copy link

wbehrens-on-gh commented Feb 5, 2022

I want to start this by saying that after using msgpack-cxx for a while I'm blown away at how fast it is in production and how simple its interface is. The problem I'm having is that I'm using Conan to manage dependencies for my project since it requires cross compiling for lots of platform, when I install msgpack-cxx from Conan and it has to build from source I noticed it was taking a long time for what seems like a very lightweight library. When looking through the dependency tree I noted that msgpack-cxx depended on boost, I found this strange because msgpack-c doesn't and compiled so much quicker. So, to prove this is an issue I did a relatively simple test of compiling some more popular c++ binary serialization libraries from source out of Conan and comparing build times.

time conan install capnproto/0.9.1@ --build

capnproto

real 1m54.295s
user 6m31.118s
sys 0m26.593s

time conan install protobuf/3.19.2@ --build

protobuf

real 1m0.287s
user 6m24.776s
sys 0m19.683s

time conan install msgpack-cxx/4.0.3@ --build

msgpack-cxx

real 2m53.061s
user 10m59.155s
sys 0m41.674s

time conan install msgpack-c/4.0.0@ --build

msgpack-c

real 0m3.888s
user 0m1.253s
sys 0m0.275s

As you can see msgpack-cxx comes dead last while msgpack-c comes in a distant first place, btw I did clear the Conan cache after every build so that EVERY dependency would be build from source. msgpack-c being so quick proves my suspicion that it's only slow because it has to compile boost, to prove this again I did the following.

conan install boost/1.78.0 --build
time conan install msgpack-cxx/4.0.3@ --build missing

msgpack-cxx with prebuilt boost

real 0m1.863s
user 0m0.662s
sys 0m0.099s

So my question is, why does msgpack-cxx depend on boost? if msgpack-c doesn't and works fine wouldn't it be easier and lighter to make a c++ style wrapper around msgpack-c? what is msgpack-cxx even using boost for that msgpack-c didn't need it? If someone could point me down the right path I'd be willing to try and make a pr to remove the dependency if it's not to difficult.

@redboltz
Copy link
Contributor

redboltz commented Feb 5, 2022

msgpack-c C++ depends on boost from long time ago implicitly.
Copy boost code and re-write BOOST prefix to MSGPACK. It was unnatural approach and difficult to manage.
See #982 .

@wbehrens-on-gh
Copy link
Author

I don't understand? so it's not being used but is still required?

@redboltz
Copy link
Contributor

redboltz commented Feb 5, 2022

Boost is required. See #982 (comment)
The old version just hid the boost dependency by copy modify paste the code. It was not good.

@wbehrens-on-gh
Copy link
Author

ah, so why does msgpack-c not need it and msgpack-cxx does? Exactly what part of boost is being used? would the msgpack-cxx team be against a pr to remove it?

@redboltz
Copy link
Contributor

redboltz commented Feb 5, 2022

See #982

@wbehrens-on-gh
Copy link
Author

So if I'm understanding your cmake correctly you're only using boost for c++ versions before c++11 only? which means enabling c++11 disables the boost requirement?

@redboltz
Copy link
Contributor

redboltz commented Feb 5, 2022

C++ version requires boost. C version is not.
The version of C++ (C++11 14 17) is not related.
I said "old version", that means https://github.com/msgpack/msgpack-c/releases/tag/cpp-3.3.0. (It was the last release mixed C and C++ verison)
Before 3.3.0, C++ part of msgpack-c depends on the boost too, But it was hidden.
The boost code is copied and modified, and then contained the msgpack-c include directory.
It was difficult to magane. When boost fixed the issue and if msgpack-c depends on the fixed part , the issue isn't fixed my boost update. So the copying boost mechanism has been removed since 4.0.0.

@redboltz
Copy link
Contributor

Solved by #1002. msgpack-c implicitly depends on boost even if MSGPACK_NO_BOOST is defined.

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

2 participants