Performance Comparison from Delphi 2010 to Delphi XE6 (Part 7 – RSCL)

RSCL Execution (Speed) Tests

Display of the SVG clock using FMX TCanvas operations in the iOS test app

Display of the SVG clock using FMX TCanvas operations in the iOS test app

Last week, we tested the various Delphi versions with sample applications using the Inference Engine Component Suite (IECS).  It provided interesting details for non-visual performance as well as a mix of non-visual and visual performance.  Our final tests are going to use the RiverSoftAVG SVG Component Library (RSCL) to test the graphics performance of the FMX Delphi versions, e.g., Delphi XE2 through XE6.  The FMX TCanvas is graphics hardware accelerated, using DirectX on Windows and OpenGL on OSX, iOS, and Android.  In addition, Delphi XE6 added DirectX 11 support so it will be interesting to see if that makes a difference.

Display of the SVG watch using FMX TCanvas operations in the iOS test app

Display of the SVG watch using FMX TCanvas operations in the iOS test app

About the RSCL Test Applications

There are actually two types of RSCL applications we are going to test.  The first type of RSCL applications will test the drawing speed of the FMX TCanvas routines by drawing SVGs.  They render SVG files using low-level canvas operations (gradients, paths, text, etc) and are available for VCL and FMX.  The VCL versions use GDI+ (which is a software renderer with comparable features to the FMX TCanvas) so they should provide a good baseline of the FMX DirectX and OpenGL hardware-based rendering.

Display of the SVG car using FMX TCanvas operations in the iOS test app

Display of the SVG car using FMX TCanvas operations in the iOS test app

The RSCL is also able to build SVGs using the FMX shape primitives (TRectangle, TPath, TText, etc); it should reveal any optimizations (or lack thereof) Embarcadero has been doing with the low-level primitives from which most FMX controls are built.

Display of the SVG flag using FMX shape primitives in the iOS test app

Display of the SVG flag using FMX shape primitives in the iOS test app

For simplicity with deploying mobile apps, all of the projects store the test SVGs inside a TClientDataSet in the app/application. The SVG applications are only testing drawing using low-level canvas operations or shape primitives; the loading, parsing, and building of the RSCL SVG elements and primitives are not tested.  There are four SVGs used in the tests:

  1. Clock
  2. Car
  3. Watch
  4. Flag

The following table breaks down the SVG elements that make up each SVG:

Listing of SVG Elements for each SVG

Listing of SVG Elements for each test SVG

Something to note is that these test applications should not be taken as an indicator of the pure TCanvas speed you can get in FMX.  The SVGs are incredibly complicated, with lots of paths, gradients, transparencies, CSS styles, etc.  The RSCL is saving canvas state before drawing each element and restoring canvas state after drawing each element.  Each SVG element has its own brush and pen (or Fill and Stroke in FMX terminology).  There are a lot of canvas operations occurring besides the pure filling of a graphics primitive (rectangle, ellipse, path, etc).

Another thing to note is that these drawing tests are not representative of the RSCL TRSSVGImage component performance.  The TRSSVGImage component draws an SVG once to a backscreen bitmap and then just draws the backscreen bitmap as needed when painting is called for.  These drawing tests deliberately use a TPaintBox and draws an SVG each time the TPaintBox is refreshed.  Even then, we removed the first drawing call from the performance times as the RSCL has to build the Brushes and Pens (Fills and Strokes) in the first drawing call but caches them for later drawing calls.

RSCL Drawing Application, FMX, Win32

Our first series of tests with the RiverSoftAVG SVG Component Library (RSCL) will be the RSCL Drawing application for Win32.  As mentioned earlier in the series, our test machine for Windows is a Windows 7 64-bit Intel I7 930 @ 2.8 GHz CPU, and 6 GB RAM.  The graphics card is an ATI HD5700 (not a top performer) using the latest AMD 14.1 drivers and with DirectX 11.  Note that no special effort was made to choose the TCanvas implementation; we let each Delphi version pick its default.

Comparison of averaged execution speed for the FMX RSCL Drawing application (Win32) with the baseline GDI+ VCL application, for Delphi XE2 to XE6

Comparison of averaged execution speed for the FMX RSCL Drawing application (Win32) with the baseline GDI+ VCL application, for Delphi XE2 to XE6

As a sanity test, we will first compare the FMX version to the VCL version.  Since the VCL version uses GDI+, which is a software graphics library, the hardware-optimized FMX TCanvas operations should be significantly faster.  Thankfully, that is what we see.  Every Delphi version of the FMX application was almost 4x faster on average than the VCL application (XE6).

Comparison of execution speed for the FMX RSCL Drawing application (Win32) with Delphi XE2 to XE6

Comparison of execution speed for the FMX RSCL Drawing application (Win32) with Delphi XE2 to XE6

Zooming in on the drawing performance for each individual SVG, we see that Delphi XE5 drew the Flag fastest, but that Delphi XE4 drew the Watch and Car the fastest.  Every version of Delphi drew the Clock in 7-8 ms (11x-12x faster than the GDI+ performance).  Overall, Delphi XE4 was the fastest in Win32.

*Note that Delphi XE3 had visual artifacts drawing the Car and the Watch.  

RSCL Drawing Application, FMX, Win64

Moving to 64-bit, every version of Delphi was faster than its 32-bit counterpart (running on Windows 7 64-bit).  This time, Delphi XE2 drew the Flag fastest.  Delphi XE6 drew the Watch fastest.  Delphi XE4 was fastest drawing the Car.  We have a 5-way tie for drawing the Clock at 7 ms.  Averaging the results, Delphi XE4 is again the winner for Win64.

Comparison of execution speed for the FMX RSCL Drawing application (Win64) with Delphi XE2 to XE6

Comparison of execution speed for the FMX RSCL Drawing application (Win64) with Delphi XE2 to XE6

Ratio of Win64 to Win32 execution speed for RSCL Drawing apps in Delphi XE2 to XE6 (FMX)

Ratio of Win64 to Win32 execution speed for RSCL Drawing apps in Delphi XE2 to XE6 (FMX)

Comparing the ratio of performance of Win64/Win32, Delphi XE2 and XE6 saw the largest performance gain when moving to Win64.  It is difficult to see if Delphi XE6 gained anything with its DirectX 11 compatibility.

*Note that Delphi XE3 had visual artificacts drawing the Car and the Watch.  

RSCL Drawing Application, FMX, OSX

Things get much more interesting when we move to Mac OSX.  The FMX programs are using OpenGL instead of DirectX.  Delphi XE2 is fastest drawing the Car and ties with XE3 for drawing the Clock.  Delphi XE5 is fastest drawing the Watch; XE3 gets another tie when drawing the Flag.  Delphi XE6’s showing in OSX is not so impressive at first glance, as it is dead last with the two least complicated SVG objects (Clock and Flag) and in the back of the pack with the two more complicated SVG objects.  However, it should be noted that the XE6 is only 5.5 ms (Clock), 3 ms (Car), 4 ms (Watch), and 4 ms (Flag).  Averaging the results, Delphi XE2 is the winner for OSX.

Comparison of execution speed for the FMX RSCL Drawing application (OSX) with Delphi XE2 to XE6

Comparison of execution speed for the FMX RSCL Drawing application (OSX) with Delphi XE2 to XE6

Ratio of Win32 to OSX execution speed for RSCL Drawing apps in Delphi XE2 to XE6 (FMX)

Ratio of Win32 to OSX execution speed for RSCL Drawing apps in Delphi XE2 to XE6 (FMX)

Display of the SVG Clock using FMX TCanvas operations in the OSX test application

Display of the SVG Clock using FMX TCanvas operations in the OSX test application

Display of the SVG Watch using FMX TCanvas operations in the OSX test application

Display of the SVG Watch using FMX TCanvas operations in the OSX test application

The really interesting thing is how fast the OSX implementation is compared to the Win32 implementation.  With the exception of the Clock, the OSX versions clean the Win32 versions clocks (pun unintended 🙂 ), being anywhere from 1.2x-4.2x faster.  It must be noted that the Windows box and the Mac Mini are not exactly comparable.  The Mac Mini is an OSX 64-bit Intel I7 @ 2.3 GHz with 4GB RAM.  Admittedly, the ATI HD 5700 is almost 5 years old now, but the Mac Mini uses integrated graphics.  Examining the outputs closely, there are slight differences in the output (see the dark lines in the Car).  Generally, however, the output from the OSX versions are excellent.

Display of the SVG car using FMX TCanvas operations in the OSX test app

Display of the SVG car using FMX TCanvas operations in the OSX test app

Display of the SVG Flag using FMX TCanvas operations in the OSX test application

Display of the SVG Flag using FMX TCanvas operations in the OSX test application

*Note that Delphi XE3 had visual artificacts drawing the Car and the Watch.  

RSCL Drawing Application, FMX, iOS

Moving to mobile, our drawing times get much slower.  This is expected as the mobile hardware is much slower than the desktop hardware.  For testing iOS apps, we used an iPod Touch with 32GB.  For testing Android apps, we used a Nexus 7 (2013) with 32GB.

Comparison of execution speed for RSCL Drawing App (iOS) from Delphi XE4 to XE6

Comparison of execution speed for RSCL Drawing App (iOS) from Delphi XE4 to XE6

The interesting thing is that Delphi XE5 is the clear winner on iOS in drawing the SVGS.  It is fastest drawing three of the SVGs and only 26 ms (approx. 4%) slower than XE4 when drawing the Car.  Delphi XE6 is the slowest in drawing in iOS.

*Note that Delphi XE4 had minor visual artificacts (gradients) drawing on iOS.  

RSCL Drawing Application, FMX, Android

On an Android device, Delphi XE5 maintains its speed lead over Delphi XE6.  Delphi XE5 is 4-10% faster than Delphi XE6 drawing the SVGs.

Comparison of execution speed for RSCL Drawing App (Android) between Delphi XE5 and XE6

Comparison of execution speed for RSCL Drawing App (Android) between Delphi XE5 and XE6

In the next blog post, we will finish our performance tests with the RSCL Primitives application tests…

Leave a Reply

Your email address will not be published. Required fields are marked *