As always, this year’s Meeting C++ conference contained three keynotes and lots of interesting talks. The introduction keynote, What is the next big paradigm? by Andrei Alexandrescu, discussed one of the problems we are currently facing in developing C++ library development: the size of the final binary and (even more) the size of the codebase.
A slide from Andrei's keynote that leaves a strong impression on every C++ developer.
The bigger the codebase size, the higher the probability of bugs. It’s important to have as small as possible codebase size without sacrificing features or performance. To achieve that, Andreis suggested a new paradigm in programming that he called Design by introspection. The idea behind this paradigm is to have a small, but smart codebase that can be compiled into various combinations of features using the static reflection. The static reflection is similar to reflection used in Java, C#, Python, and other similar languages, but without having any impact on performance - the entire code introspection is done at compile time.
At the moment, C++ has very limited support for static reflection, but some of the features can be obtained using tricks with the preprocessor macros. We implemented such tricks during our biggest code refactor we've ever made. We used those tricks internally in the Microblink’s C++ codebase to easily create instances of various BlinkID recognizers with minimal code. This enabled us to quickly add support for scanning new documents.
Microblink’s C++ codebase mostly uses the policy-based design paradigm - another invention by Andrei. However, particular small parts of BlinkID recognizers use ideas that are very similar to Andrei’s new paradigm. Considering that, as well as the fact that BlinkID has an option for creating a minimum-size customized build (check the documentation for iOS or Android to see how), we’re very glad to see the architectural decisions we made at Microblink be confirmed by world’s renowned experts such as Andrei.
Besides keynotes, we also had the opportunity to catch several other talks. One that we would like to highlight is Jonathan Müller’s talk about writing cache-friendly C++ code. You can find slides for his talk on his personal blog. Having a cache-friendly code in your codebase means that your code is running faster, as the processor doesn’t have to wait for memory; everything important is inside the processor's cache memory. This is hugely important for performance critical systems, such as Microblink’s Deep OCR.
Miro Knejp’s talk about pinned_vector was also interesting. The idea described in this talk has already been implemented within Microblink’s Deep OCR.
Last but not least, we would also like to point out Alexander Radchenko’s talks about benchmarking C++ code. One of the key takeaways from this talk is that performance is a currency that can be spent - if you have high performance of your code on a particular device, you can spend it to provide more features. In BlinkID, we “spend” that performance on high-end devices in a way to perform multiple OCRs of the same document, and offer better scanning quality than on low-end devices, where such approach would take too much time.
One of the main aspects of every conference is the networking, of course. We’ve met lots of different developers with whom we got to exchange experiences. We were especially excited to meet the team behind the Conan C++ Package manager, a tool that we recently integrated into our build system. It reduced the development compile-test cycle on our Continuous Integration server from over 45 minutes to less than 5 minutes, and the BlinkID SDK release build from over one hour to less than 10 minutes. This significantly reduced the waiting time for compiling code and enabled our developers to spend more time actually coding.
Besides that, the Conan team organized a very amusing C++ quiz on Wednesday, which helped a lot with networking for (usually shy) developers, as the rules required that each team was not comprised of people from the same organization. Unfortunately, none of the teams where our devs participated won, but nevermind. The quiz questions were amusing and in fact quite difficult. Here are a few pictures with quiz questions:
What is the output of this program? You've got 30 seconds to provide the answer.
What about the output of this program? It certainly isn't I want to break free. Also 30 seconds on the clock.
Diego Rodriguez-Losada, the author of the C++ package manager and the C++ quiz author, presenting one of the quiz questions.
We had a great time at another Meeting C++ and enjoyed our stay in Berlin very much. Looking forward to next time!