As you know Delphi 10.2 Tokyo has been released recently. An author of codingforspeed.com had a pre-release version of Delphi and published results of an integer performance comparison test some time ago:
https://codingforspeed.com/integer-performance-comparison-for-c-c-delphiAccording to this test, latest version of Delphi performs better than Visual C++ on Win64 target. The test measures both single-thread and multi-thread performance, and Delphi has significant lead in both tests.
Since then the official release has been announced, and I installed Starter Edition. The source codes of this test are on
Github, so I decided to give it a try. Meanwhile Visual Studio 2017 also released. Now we can see if C++ 2017 has any improvements.
Test setup:
RAD Studio 10.2 Starter, Delphi Version 25.0.26309.314
>> Supports only Win32 target.
Visual Studio Community 2017, Version 15.0.0+26228.9, .NET Framework Version 4.6.01586
>> Supports Win32 and Win64 targets for C++, only Any CPU for C#.
Lazarus 1.6.4 64-bit, SVN Revision 54278
>> Supports Win64 target, Win32 target needs add-on.
Desktop PC:
Windows 10 64-bit, Build 1607
AMD A10-7860K@3.8 GHz
16 GB 2133 MHz DDR3 RAM
I tried to use latest versions of development environments. On particular CPU I am using I got these results:
--- Any CPU ---
C# Serial 11344
C# Parallel 2921
--- Win32 ---
C++ Serial 11656
C++ Parallel 2937, 2984
Delphi Serial 11406
Delphi Parallel 3094, 2890, 2969
Lazarus Serial 11750
Lazarus Parallel 4656
--- Win64 ---
C++ Serial 11687
C++ Parallel 2922, 2969
Delphi Trial Serial 11203
Delphi Trial Parallel 3157, 2828, 2922
Lazarus Serial 11359
Lazarus Parallel 4250
Conclusion:
In Delphi, there were 3 different methods to implement concurrency for the tested calculation. In C++, the author came up with 2 methods. Although Delphi Starter doesn't support Win64 target, Win32 test alone showed a very promising result. Lazarus is also following Delphi closely. Parallel code didn't work in Lazarus so I only did serial test, and it is 2.8% faster than C++ on Win64 target. I attached the Lazarus code I used.
You can also post your test results, especially if you have 64-bit Delphi, so we can have a better idea of latest situation. If you like you can post results of other benchmarks like SciMark too. It would be nice if we have a broader perspective of how latest compiler versions are performing.
When it comes to performance, Pascal compilers compete each other. There is no other competition
Edit:
Using the code suggested by ykot, multi-threading test for Lazarus was performed and results were updated. Compared to other products, the latest stable version of Lazarus has mediocre parallel processing speed.
Edit2:
I discovered that RAD Studio 10.2 Trial has Delphi Win64 compiler, so I added results for Delphi Win64.
You can download
Delphi 10.2 Tokyo Starter here, it doesn't have a time limitation but it supports only Win32 target:
https://www.embarcadero.com/products/delphi/starter/promotional-downloadRAD Studio 10.2 Tokyo Architect Trial includes Delphi Win64 compiler and all cross-compilers:
https://www.embarcadero.com/products/rad-studio/start-for-free