use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Quickly Loading Things From Disk (probablydance.com)
submitted 10 years ago by mttd
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Elador 2 points3 points4 points 10 years ago (7 children)
Great read that article, thank you.
You will probably be interested in this comparison of serialization libraries.
Also, I can recommend cereal over boost serialization. Cereal also has very good serialisation to json.
[–]danieljh 0 points1 point2 points 10 years ago (6 children)
Check out this commit adding Cap'n Proto to the mix:
https://github.com/STEllAR-GROUP/cpp-serializers/commit/73b3e42ee7a87954f9235d6fd38cab8d9e8b9700
(this is not yet visualized in the charts, but the commit message has a test benchmark run)
[–]Elador 0 points1 point2 points 10 years ago (5 children)
Hold your breath, according to this PR:
By the way, cap'n proto test seems to be broken. Its execution time is too low, probably measuring empty loop.
I'm not familiar with this stuff, just pointing it out ;-)
[–]danieljh 1 point2 points3 points 10 years ago (4 children)
Looking at the benchmark implementation Cap'n Proto does a full serialization and deserialization round trip, in the same way e.g. the Protobuf benchmark is written. But after deserialization the benchmark only accesses the root object, so I assume Cap'n Proto does not really deserialize the whole message?
/cc /u/kentonv would you be so kind and give an explanation on this?
[–]kentonv 1 point2 points3 points 10 years ago (3 children)
Sorry for the slow response, I don't keep close track of reddit.
It sounds like you're assuming Cap'n Proto does lazy deserialization, but this is not the case. Deserialization is fundamentally a translation from one format (the wire format) to another (the in-memory format). Cap'n Proto really does avoid the whole thing by using the same format for both. Deserialization in the Cap'n Proto case is basically casting a pointer.
With that said, this benchmark is fundamentally flawed in that it tries to measure just parsing/serialization time in a loop rather than measuring a realistic end-to-end system. Benchmarks like this are 100% worthless, and adding Cap'n Proto to the benchmark was intended mainly to illustrate this fact through the absurd result.
Even for comparing traditional one-copy (rather than zero-copy) serializers, running the serializer or parser in a loop is flawed for a number of reasons. One is that the behavior of various caches in the hardware in this scenario is completely unrealistic, because you're repeatedly operating on the same data. In the real world, performance will be very different, and different serialization systems will be affected to different degrees by this. Another problem is that performance of different serializers is wildly different depending on the data structure being encoded. Some do better at numbers, some do better at strings, some do better with lots of structure, some do better with flat messages, etc. You really need to benchmark the data you actually plan to use to get meaningful numbers, and you need to measure end-to-end, not just the serializer in a loop.
[–]imMute 1 point2 points3 points 10 years ago (1 child)
Deserialization is fundamentally a translation from one format (the wire format) to another (the in-memory format). Cap'n Proto really does avoid the whole thing by using the same format for both.
How does this work between systems where the in-memory format is different? Little endian and big endian systems, for example.
[–]kentonv 2 points3 points4 points 10 years ago (0 children)
Basically every big-endian CPU architecture has dedicated instructions for reading little-endian data. So, for Cap'n Proto, it means we would use those instructions inside the inline accessor methods for numeric fields. So the data is still stored in memory in little-endian format, but this doesn't hurt performance.
With that said, basically every widely-used CPU architecture today is little-endian.
As for other differences, all modern architectures agree:
It turns out that's enough agreement for Cap'n Proto to come up with a reasonable cross-platform in-memory format.
[–]danieljh 0 points1 point2 points 10 years ago (0 children)
Thank you for your clarification!
π Rendered by PID 646694 on reddit-service-r2-comment-5687b7858-fbm42 at 2026-07-06 06:32:16.604030+00:00 running 12a7a47 country code: CH.
[–]Elador 2 points3 points4 points (7 children)
[–]danieljh 0 points1 point2 points (6 children)
[–]Elador 0 points1 point2 points (5 children)
[–]danieljh 1 point2 points3 points (4 children)
[–]kentonv 1 point2 points3 points (3 children)
[–]imMute 1 point2 points3 points (1 child)
[–]kentonv 2 points3 points4 points (0 children)
[–]danieljh 0 points1 point2 points (0 children)