What's New in C++Builder 10.2: Part 2 - Code Generation
RAD Studio 10.2 Tokyo will be out very soon, and I'd like to let you know some of what you can expect to see new on the C++Builder side. While the majority of work is for Linux, which will be available for C++ in 10.2.1, we've worked on three key areas:
Today I want to discuss what's new for code generation.
Optimization Levels - new and faster!
In all previous versions of C++Builder, going back to when the classic compiler was the only compiler, there were only three optimization levels, counting 'none' as an option:
- None: -O0 (used for debugging)
- Generate smallest possible code: -O1
- Generate fastest possible code: -O2
Although these use the -On compiler flag that's traditional for all C++ compilers, in the past these were not labeled with an 'O' flag in the IDE description. Optimization descriptions are tricky, and especially with the Clang compilers map to a variety of different options. 'Generate smallest', for example, could also be 'Prefer smaller code' or 'Optimize for size' or similar. Some IDEs don't even try to describe the options, just give the number, but it's generally understood a higher optimization level usually results in faster code.
In C++Builder 10.2, we are adding a fourth level, -O3:
- Generate most optimized code (-O3)
For the Clang-enhanced compilers, this matches -O3 for other compilers, and adds vectorisation and inlining above O2. (For classic bcc32 this maps to -O2.)
As with any optimisation flag, you need to test the results with your own code. However, for some internal tests, -O3 gives speed improvements of up to twice the performance of -O2. We suggest that for release builds, you will usually want to build with either -O2 or -O3 and you may see large improvements for -O3.
O1 and O2
We have also addressed several code generation issues at these levels. Even if you don't take advantage of -O3, your code will be more robust in 10.2.
Adding a new optimization level, or other optimization or compiler flags, is a lot of work: it involves heavy testing and fixing many small and unusual corner cases, in both the compiler and linker. We are pleased to offer -O3 since performance is important to C++ customers.
We're looking into what other performance-related changes we can make in future, and nothing is off the table. Your feedback here would be appreciated in order to deliver the best compiled code performance that you need. Meanwhile, in 10.2, we hope you enjoy your faster -O3 code!
Please login first in order for you to submit comments
- Page :