A long time ago, there was an interesting blog post referenced from [WayBack] See how you can use Delphi’s upcoming new language feature to improve performance of your code. – Erik van Bilsen – Google+ referred to [WayBack] Inline Variables can increase performance – grijjy blog which made me comment [WayBack] “given the potential performance improvements the compiler already could do, and how long they could have been done, I would not bet on these new improvements becoming reality anytime soon.” that I later backed up with these links:
- [WayBack] Which Delphi compiler produces faster code? – Synopse
- [WayBack] Floating Point Optimization Comparison in Delphi 2007 and XE3 | Technology of Computing
- [WayBack] Following on from the recent discussion (…) on C# performance (compared to Delphi), I upda… – David Heffernan – Google+
- [WayBack] optimization – Does Delphi XE produce faster code than Delphi 2007? – Stack Overflow
One of the observations there is that since Delphi 2005, no major compiler speed improvements have been done, and that even between Delphi 5 and 2005 mot much has been done either.
From my point of view, the – not so big – Delphi compiler team is very busy keeping balls up in the air supporting the many compiler targets and architecture changes that have been introduced over the past decade or so, that they do not have resources to improve code generation other than rely on the LLVM tool chain (which is not used for Windows x86 and x64 development that covers like 90+% of the Delphi users).
In my book, when you need an “inline var”, you usually want to refactor that bit of code into a separate method anyway.
Refactoring out parts of code that have implicit try/finally blocks for managed variables or records is a strategy that can improve execution speed in many Delphi applications anyway, especially if that piece of code is outside of the happy flow: it moves unneeded overhead out of that flow.
This is actually a strategy used for instance in the Spring4D library: Stefan Glienke has a very good insight in how the compiler works and did magic to some performance critical code paths there.
–jeroen