First look at XE2 floating point performance

With XE2 now officially out, it’s time for a first look at Delphi XE2 compiler floating point performance (see previous episode).

For a first look I’ll reuse a Mandelbrot benchmark, based on this code Mandelbrot Set in HTML 5 Canvas. What it tests are double-precision floating-point basic operations (add, sub, mult) in a tight loop, there is relatively little in the way of memory accesses (or shouldn’t be, to be more accurate).

(more…)

A Fistful of TMonitors

…or why you can’t hide under the complexity carpet 😉

As uncovered in previous episodes, one of the keys behind TMonitor performance issues is that it allocates a dynamic block of memory for its locking purposes, and when those blocks end up allocated on the same CPU cache line, the two TMonitor on the same cache line will end up fighting for the cache line, resulting in a drastic drop of performance and thread contention. The technical term for that behavior is false sharing.
(more…)

Once upon a time in a thread…

Last episode in the TMonitor saga. In the previous episode, Chris Rolliston posted a more complete test case, for which he got surprising results (including that a Critical Section approach wouldn’t scale with the thread count). Starting from  his code I initially also got similar surprising results.

edit: apparently the “crash” part of the TMonitor issues have been acknowledged by the powers that be, and a hotfix could be on the way, though it points back to QC 78415, an issue reported in 2009, ouch. Guess those 4 bytes per instance haven’t seen much use…
(more…)

TMonitor woes

Primoz Gabrijelcic recently reported a possible bug with TMonitor, in the more advanced side of TMonitor.

However, when experimenting with it for DWS, I bumped on issues in the basic usage scenarios too, and reverted to using critical sections. It seems that as of Delphi XE, short of a patch, TMonitor is just a waste of 4 bytes per object instance.
(more…)

Delphi for JavaScript

A while back, I posted of FireFox 4 JavaScript engine running around Delphi when it came to floating point performance on the Mandebrot set, since then, Chrome got updated to version 11, and further raised the bar by beating FireFox by about 20% in that benchmark. That’s no mean feat: current generation JavaScript engines run not just faster than Delphi, but also .Net and a slew of other compilers, native or not, when it comes to floating point. Only state of the art native compiler still resist.

The figures for Delphi 64 are still unknown, but it’ll face a challenge merely matching the floating point performance of JavaScript, and if the VCL’s TCanvas hasn’t been revamped from the ground up, chances are that out of the box, Delphi 64 won’t be able to beat the HTML5 Canvas on performance (not to mention in features, where HTML5 Canvas is also leading by a few miles).

(more…)

Delphi 64 beta official after all

Did the attention that my little April 1st post drew help set things in motion a little earlier than planned?

It’ll be denied, it wasn’t seen, and it can’t be proven, it’s just that the slides and the video look a bit rushed, but anyway, on a just released Delphi 64 sneak preview page on the Embarcadero website, there  is a now a “join the beta” link, were you can apply for the beta. However the beta isn’t open, and Delphi XE users will apparently have priority.

As for the preview keypoints themselves, Marco Cantu has an executive summary.

It seems the beta will be under the usual NDA terms, so it may be some more time before more details filter out.

Delphi 64 open beta now available!

In a bold (or unintentional?) move, a Delphi 64 beta has been released on the Embarcadero servers, there is no official announce yet, so hit the link below while it’s still there, it may not last long!

Delphi 64 (maybe open?) beta download

..alas this was just for april’s fool… Let’s hope the next announcement about Delphi 64 availability will happen before April 2012!

edit 04/04: coincidence? They’ll deny it, no one saw them do it, and anyway no one can’t prove anything, but the following announces have just been made:
Delphi 64-bit Compiler Sneak Preview and Beta – Official Announcement
Delphi 64-bit Compiler Preview and Beta Program
And Marco Cantu has the exec summary: Delphi 64 bit Sneak Preview
With none other than David “let’s-have-a-drink” Intersimone as host for Embarcadero page for “Pulsar” beta being http://www.embarcadero.com/products/delphi/64-bit

Kudos to the Firefox 4 TraceMonkey team!

I’ve been quite impressed with the JavaScript floating point performance in FireFox 4, which puts the Delphi compiler to shame. See for yourself this fractal rendering demo:

Mandelbrot Set in HTML 5 Canvas

I’ve made a version of the same code in Delphi XE (source + pre-compiled executable, 331 kB ZIP), and on my machine here, for the 480×480 resolution, where FireFox 4 gets the default view rendered in 124 ms, where the “regular” Delphi version, which is limited to the old FPU, takes about 200 ms

(more…)