Head to Head: Smart Mobile Studio vs. Embarcadero Delphi
I know I have been writing a lot about Smart Mobile Studio and memory access lately. But I’m sure you all understand that it’s just as vital in HTML5 applications as it is under native Delphi or C# applications.
Having spent the better part of this weekend optimizing and re-factoring the codebase, I am now able to write 1.000.000 (one million) records to memory in 417 milliseconds. At first I did not believe that it could be possible, there had to be some error somewhere or perhaps the data was not actually written. But using hexdump and inspecting the buffer avails that yes – there is no error, it’s that bloody fast.
mChunk:=0; mMake.Allocate(21000021); mStart:=Now; for x:=0 to 1000000 do begin mMake.Write(mChunk + 0,$AAAA0000); mMake.WriteFloat32(mChunk + 4,19.24); mMake.WriteFloat64(mChunk + 8,24.18); mMake.Write(mChunk + 16,false); mMake.write(mChunk + 17,$0000AAAA); inc(mChunk, 21); end; mStop:=Now;
Thankfully a genius french developer, Eric Grange, which is the maintainer of Delphi Web Script (DWS) came to my aid. What he did was create a HTML5 canvas demo which outperformed Delphi by magnitudes. First using FireFox which is as we all know slightly slower than Webkit, but later he executed the same code in Webkit’s V8, leaving native Delphi in the dust.
The moral of the story here is that we were never out to humiliate Delphi. Quite the opposite, Smart Mobile Studio was created as a toolkit for Delphi developers. In fact it was created to help Embarcadero venture into new markets. I would never suspected to be treated like we have been by Embarcadero, which has blacklisted our entire team from public events, threatening to poll funding if we are allowed to speak (!)
But it has made one thing clear. I no longer care if Embarcadero is damaged by my products. With the exception of two individuals working for EMB, they have not given me (or my team) the time of day. Which is strange, because our technology would revolutionize and to some degree re-vitalize the Delphi brand. Something it sorely needs.
Well, today I am pleased to announce that not only does Smart Mobile Studio humiliate Delphi in every graphics operation known to mankind, including 3D rotation of user-controls; Smart Mobile Studio is now faster in every aspect of memory manipulation. This includes:
- Writing un-typed array to memory
- Writing typed arrays to memory
- Moving data between two memory segments
- Moving data within the same memory segment
- Reversing the data inside a memory segment
- Fill a memory segment with char data
- Fill a memory segment with un-typed data
- Fill a memory segment with typed-data
The tests were all done on VMWare Fusion running on an 2.7 Ghz Intel Core i5 iMac with 8 GB memory (1600 Mhz DDR3).
1 Gigabyte of memory was allocated for the VMWare machine, which is running Windows 7 Ultimate Service Pack 2. The tests were performed using Chrome (Smart Mobile Studio ships with Chromium Embedded) and Chrome for OS X.
The following Delphi versions were used in my tests:
- Delphi 7
- Delphi 2005
- Delphi 2006
- Delphi XE
- Delphi XE3
- Delphi XE6
- Delphi XE7
To be perfectly honest, I have begun to re-compile more and more Delphi projects using FreePascal and Lazarus these days. And we are moving Smart Mobile Studio to FreePascal as well. It gives us the benefit of compiling our product for OS X, Linux and Win32.
It also puts to rest any clause in the Embarcadero License which prevents users from producing executables from a Delphi application (yeah, it’s that screwed up!). So yes, a FreePascal powered version of Smart Mobile Studio will appear sooner or later.
The memory management unit, support for streams and marshaled pointers will be available in the next update of Smart Mobile Studio, so you can download a trial version if you dont own a license and run the tests yourself.
The full source-code will be posted here shortly, it’s identical to the SMS version in both payload and infrastructure.