Hello World Execution (Speed) Tests
We’re back to continue this string of blog posts into the performance differences between Delphi 2010 through Delphi XE6, and between all platforms. This week we continue our speed tests from last week by finishing up our performance tests for the Hello World project from the introduction.
Last week, we saw that performance differences in the VCL are minor. With the Win32 version of the FMX Hello World application, it was more interesting. When filling a TListBox, at small number of items, the XE2 version is fastest. Surprisingly, at higher numbers of items, Delphi XE3 is fastest. For filling a TMemo, Delphi XE6 rocked and managed to be faster than every other version of Delphi except XE4 when not using BeginUpdate/EndUpdate, and faster than all other versions of Delphi when using BeginUpdate/EndUpdate (even the VCL versions, though this comparison is not really valid as the VCL TMemo, when BeginUpdate/EndUpdate methods are not used, draws every string as it is added while the FMX TMemo does not)!
This week, we are going to continue our tests with Win64 and then investigate non-windows platforms.
As we noted in our update last post, please notice that the FMX charts have a logarithmic y-axis for execution time. With FMX, execution times vary so greatly between a small number of items and a large number of items that filling a TListBox or a TMemo with 10000 items would swamp out the other results and make them appear tiny and indistinguishable.
Hello World, FMX, Win64
The FMX Win64 speed tests for filling a TListBox hold no new surprises and closely mirror the Win32 tests. With the FMX Hello World application, at small number of items, the XE2 version is fastest using the TListBox. However, as mentioned in the update to last week’s post, the Delphi XE2 TListBox is crippled when clearing items (which is not reflected here) and shows exponential times in clearing the list box. At higher numbers of items, Delphi XE3 is fastest. Delphi XE6 manages to be insignificantly faster than Delphi XE4 and XE5 when not using the BeginUpdate/EndUpdate methods. Using BeginUpdate and EndUpdate, Delphi XE6 is slower than every prior version until we get up to 10000 items where Delphi XE2 is the slowest.
Comparing Win64 FMX to Win32 FMX execution, surprisingly only Delphi XE2 manages to be faster in Win64 on a Windows 64-bit OS and machine (though even it cannot do it when using BeginUpdate/Endupdate methods at 10000 points). Delphi XE3, at a small number of items is faster filling a TListBox in Win64 than Win32. Delphi XE4, XE5, and XE6 for some reason are all slower filling a TListBox in Win64 vs Win32 when executed on a Windows 64-bit OS and machine.
Filling a TMemo, the picture changes. Because the FMX version of TMemo does not draw each line as it is added, the Delphi versions manage to maintain a speedy pace. Delphi XE4 is fastest when filling a TMemo with no BeginUpdate/EndUpdate method calls. Delphi XE6 is strong again and is the fastest when using the BeginUpdate/EndUpdate methods.
For all versions of Delphi except for XE2 in some cases, the 64-bit version of the FMX Hello World application is faster than its 32-bit FMX counterpart when filling a TMemo.
Hello World, FMX, OSX
Now for the really exciting tests, how do the different versions of Delphi do on other platforms? Our first tests will be the Hello World application running on OSX. Since Delphi XE2, there has been support for creating applications for the Mac. For our tests, we use a 2.3 GHz Intel Core I7 Mac Mini with 4GB 1600 MHz DDR3 RAM running OSX 10.9.2.
The results for filling a TListBox in OSX is interesting. In general, Delphi XE3 is the fastest when BeginUpdate/EndUpdate are not called. When BeginUpdate and EndUpdate are called, Delphi XE5 has a very strong showing, beating out all other versions except where Delphi XE3 manages to eke out a win by 1/10 of a second for 10000 items.
Delphi XE6 gives competent but not winning numbers. It is faster or practically equal to Delphi XE4 and XE5 when not using the BeginUpdate/EndUpdate methods. If BeginUpdate and EndUpdate are called, Delphi XE6 is faster than XE2 and XE3 for 1000 items and under, and almost tied with XE3-XE5 at 10000 items.
When filling a TMemo, Delphi XE4 is particularly strong on OSX. Delphi XE4 is faster than every other version. Delphi XE6 gives an excellent showing and is in second place for all TMemo tests, and actually equalling XE4 with 100 items and BeginUpdate/EndUpdate calls.
Hello World, FMX, Win32 vs OSX Win32
Unfortunately, the Windows machine used for testing is not exactly comparable to the Mac Mini. However, the Windows Machine specs (Windows 7 64-bit Intel I7 930 @ 2.8 GHz CPU, and 6 GB RAM) are *close* to the Mac Mini specs (OSX 64-bit Intel I7 @ 2.3 GHz with 4GB RAM), so it will be very interesting to do comparisons of the FMX Win32 vs FMX OSX Hello World.
Surprisingly, adding items to a TListBox is faster on a Mac when the BeginUpdate and EndUpdate methods are ***not*** called. Once, BeginUpdate and EndUpdate are called, we get the expected results and the Windows box wins.
Adding lines to a TMemo is a rout and the Windows application wins across the board and for all versions of Delphi.
In our next post, we are finally going to compare execution speed for mobile apps…
Until then, Happy CodeSmithing!