C++C++11C++14C++17Language Feature

Interesting C++ Builder Compiler Counting Prime Number Benchmarks

1. Introduction

C++ Builder has a great IDE, includes compilers for Win32, Win64, Android and iOS. C++Builder has both CLANG Enhanced C/C++ Compiler and a Embarcadero’s new Bcc C/C++ Compiler. It also features a modern, high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform UI development. You can develop GUI based applications easily, as it comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs. There is a free C++ Builder Community Edition that can be used by students, beginners and startups with limitations.

You can download the free C++ Builder Community Edition here: https://www.embarcadero.com/products/cbuilder/starter. Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.

In this post we compared VCL and FMX compilers in Counting Prime Numbers. Prime number function is also tested in Delphi and in Python here on Youtube with Kiriakos Vlahos. We inspired from this video and we try to do same test same function in C++.

Finding Prime Numbers in C++ is explained detailed well in this Easily Learn To Find Prime Numbers In Modern C++ post.

2. System Description

PC setup that we used in tests here is;
OS: Windows 10 64 bit (Version 2004)
CPU: AMD Ryzen 7 1800X (3.6 Ghz)
GPU: Nvidia GTX 1080Ti
Drive: Samsung 960 Pro M.2 SSD

3. Counting Prime Numbers Example in C++ Builder VCL ( for CLANG and Bcc Compiler)

In this test we used our previous codes on VCL to check VCL performance of C++ Builder on the it’s new CLANG Compiler and on the classic, new Borland Bcc Compiler. Note that we made change here in our previous codes by adding (float) at this line

This (float)x definition is needed to run codes on classic Borland compiler, otherwise it gives Ambiguity error on sqrt() function because of x is integer while it needs a float number.

4. Counting Prime Numbers Example in C++ Builder FMX (for CLANG and Bcc Compiler)

This is a C++ Builder example to find number of prime numbers in a given range. Note that it runs with a Form which has a Button and a Memo box to display output.

5. Results in C++ Builder FMX (FireMonkey) framework with CLANG Compiler

6. Results in C++ Builder FMX (FireMonkey) framework with Bcc Compiler

7. Results in C++ Builder VCL framework with CLANG Compiler

8. Results in C++ Builder VCL framework with Bcc Compiler


According to all tests and results above, there are minor changes in different tests of a same cases, about +- 5 +-15 milliseconds. Here below, all results are listed in a table;

In conclusion, C++ Builder CLANG has best scores in 64bits compilation on both VCL and FMX (FireMonkey) frameworks, Bcc compiler looks slightly faster than CLANG compiler on both 32bits VCL and FMX frameworks. If we compare VCL and FMX frameworks, we can say both VCL and FMX frameworks has same performance on both CLANG and Bcc Compilers. This is expected because in these tests we don’t use any UI elements.

Please see out other tests on Dev C++, GNU C/C++, VS-Code With GNU C/C++, Python


Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He was born in 1974, Eskisehir-Turkey, started coding in college and graduated from the department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. He worked as a research assistant at the same university for more than 10 years. He received his MSc and PhD degrees from the same department at the same university. Since 2012, he is the founder and CEO of Esenja LLC Company. He has married and he is a father of a son. Some of his interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Learn C++Syntax

What Is Deleted Implicitly-declared Copy Assignment Operator In C++?

C++C++11C++14C++17C++20Learn C++Syntax

What Is A Forced (Default) Copy Assignment Operator In Modern C++

C++C++11C++14C++17C++20Learn C++Syntax

What is Implicitly-declared Copy Assignment Operator In C++?

C++C++11C++14C++17C++20Learn C++Syntax

What is Avoiding Implicit Copy Assignment In C++?

Worth reading...
Learn To Count Prime Numbers In Visual Studio Code C++