Is there a real performance gain when I turn {$IMPORTEDDATA} off ?
The manual only says this: “The {$G-} directive disables creation of imported data references. Using {$G-} increases memory-access efficiency, but prevents a packaged unit where it occurs from referencing variables in other packages.”
Update:
Here is more info I could find:
“The Debugging section has the new option Use imported data references (mapped to $G), which
controls the creation of imported data references (increasing memory efficiency but preventing the
access of global variables defined in other runtime packages)”
Almost never
This directive only refers to accessing global unit variables from another unit.
If you use {$G+}
Global1will be accessed indirectly via a pointer (if and when accessed from outside unit1)Form1will also be accessed indirectly (i.e. change from a direct pointer to an indirect pointer).if you use {$G-}, the access to integer
globalwill be direct and thus slightly faster.This will only make a difference if you use global public unit variables in another unit and in time critical code, i.e. almost never.
See this article: http://hallvards.blogspot.com/2006/09/hack13-access-globals-faster.html