Rad Studio XE6, Lo and Behold!
Delphi has featured function inlining since 2005. But it was not until XE6 and 2014 when this feature really lived up to its promise. Our MtxVec library uses default array property on records and objects to access individual values of vectors and matrices. Even though we specified the setter and getters to be inlined:
[delphi]function getDefaultArray(const Idx: integer): double; inline;
procedure setDefaultArray(const Idx: integer; const Value: double); inline;
property Values[const Idx: integer]: double read getDefaultArray write setDefaultArray; default; [/delphi]
the performance did not match access to a simple dynamic array. Well, here comes the XE6 and the speed for 1D arrays is a match. Performance improvement by 6x. Even more, when accessing elements of 2D dynamic arrays, the 2D inline property for accessing elements on matrices is faster:
[delphi]var a: TMtx; //our TObject class
d: array of array of double;
a[i,j] := 0; ///faster than d[i,j]
d[i,j] := 0;
Performance improvement by a total of 4x in compare to XE5 and before. This makes a lot of our code noticably faster simply by making use of the new XE6 Delphi compiler.
- Created on .