For our first tests, I wanted to see how much Embarcadero has been improving the various compilers (Win32, Win64, OSX, iOS, and Android) for each version of Delphi, both in terms of compilation speed and final executable size. I know that this is a trivial part of the performance comparison but I thought it is important to look at every aspect of the application making process. I took the Hello World project described in the introduction and ran it through the various Delphi compilers: 2010 to XE6, Win32, Win64, OSX, iOS, and Android.
Hello World, VCL, Win32
For the Win32 test, all compilers from Delphi 2010-XE6 were used. Every compiler was blazingly fast and with such a small application (101 lines of code), compilation was performed so fast (less than 1/4 of a second) that the difference between compilers looks like system noise. It must also be noted that the Delphi 2010 and Delphi XE compilers were run from the IDE which explains their slower execution. The interesting result, however, is EXE size. It has been apparent for a long time that each version of Delphi has been increasing the EXE size (i.e., code bloat). The results are backed up with our tests. Every version has increased the resulting EXE in size from 914KB in Delphi 2010 to over 2 MB (2258KB) in Delphi XE6. The biggest jumps were from XE to XE2 and XE2 to XE3. Note that this code bloat is not unexpected as every version of Delphi has been adding to the run-time library. Whether you find this code bloat good or bad is a matter of opinion as adding features is IMO a good thing. However, it is a shame that the Delphi linker has not kept pace with development and been aggressive in discarding unused code.
Hello World, VCL, Win64
With the introduction of Delphi XE2, both Win64 and OSX support were added. For my next tests, I compiled the Hello World application with the Delphi Win64 compilers. Again, compilation was blazingly fast (less than 1/4 second) though each version of the compiler is very slightly slower than the previous one. However, EXE size has ballooned to about a MB more than the Win32 version so compilation differences are probably just hard drive limited. Again, the EXE sizes are increasing with every version of Delphi. Delphi XE did not have a Win64 compiler so we cannot see the EXE size increase between those versions, but the jump from XE2 to XE3 is bad.
Hello World, FMX, Win32
The compilers for Win32 and Win64 are the same as that used for the VCL application. The difference is the visual component library used (FMX instead of VCL). The Hello World FMX application uses TListBox, TMemo, TEdit, TCheckBox, etc, but instead of using Windows managed controls, FMX does all of the work itself. As expected, FMX EXEs are significantly larger than their VCL counterparts. The surprise is by how much (over 2x as large) and how bad Delphi XE3 EXE sizes are (almost 4x larger). Delphi XE4 dramatically improved EXE sizes over XE3 but was not able to reduce the EXE size to XE2 levels. Since then, the EXE size has been slowly creeping up. Compilation speeds seem to track very closely to the EXE size so my guess is that we are seeing HD read/write times.
Hello World, FMX, Win64
The Win64 results closely mirror the Win32 results.
Hello World, FMX, OSX
Finally, we get to compare a completely new platform! With the release of Delphi XE2, OSX support was added. We see the same growth pattern of EXE size from Delphi XE2 to XE6, with Delphi XE3 again being the outlier. In this case, Delphi XE6 is very slightly faster than XE5 though I wouldn’t read too much into it. An interesting comparision is to compare the size of Delphi FMX applications on OSX (Win32) to their Windows counterparts (Win32). OSX applications are even larger than their Windows versions, approximately 1.5x to 2x larger. However, the OSX version from XE3 is not as comparatively huge as other Delphi versions. Also, it is interesting to see that the OSX compiler is as fast as the WinXX compilers. I believe that this is because the compiler was written by Embarcadero and does not use LLVM.
Hello World, Mobile, iOSSim and iOSDevice
In Delphi XE4, support was added for compiling and deploying apps to an iOS device (I am going to ignore the free pascal compiler from XE2). This next generation compiler creates ARM code and then uses XCode running on the Mac to deploy to an iOS device. I had difficultly compiling a release version of the Hello World Mobile app for my iPod Touch as I did not want to create a certificate for the app; I had to settle for compiling in debug for Delphi XE4. Note that these tests do NOT include the XCode part of the compile and deploy equation.
As predicted and even without the deployment step, iOS apps take significantly longer to compile than Win32, Win64, and OSX. While it is awesome that we can finally compile iOS apps, the compilation process is much slower (over 10x slower than compiling the same app for Win32) and much, much, MUCH slower when you finally deploy to device. The move to XE6 (ignoring the spurious XE4 results) has not reduced compilation time or EXE size.
Hello World, Mobile, Android
In Delphi XE5, support was finally added for compiling and deploying apps to an Android device. This next generation compiler creates ARM code and an APK file and then directly deploys it to an Android device. Note these tests do not include the deployment times. They are also executed directly in the IDE instead of the command line.
Interestingly, without the deployment step (a big caveat admittedly 🙂 ), iOS and Android EXE/APK sizes are comparable and compile in the same amount of time. Like the iOS compilations, Android apps take significantly longer (almost 12x) to compile than Win32, Win64, and OSX. The move to XE6 has not reduced compilation time or EXE size over XE5.
Test Results Conclusion
Embarcadero has not been doing a lot of work in increasing compilation speed or reducing EXE size. Except for Delphi XE3 which seems an outlier, EXE sizes have been going up slowly but steadily as more is added to the RTL. The addition of FMX greatly increases EXE sizes. The ARM compilers are 10x-12x slower than the Win32 compiler even without the lengthy deployment step. Delphi XE6 does not improve either compilation speed or EXE size. However, this is not the most important of Delphi performance.
That is all for this week. Next week, we will get to the real speed comparisons and see how Hello World execution speed compares between the different Delphi versions.