As you know, modern Delphi versions add the RTTI information to the executable file. RTTI gives you the opportunity to do incredible things in your application. But it is not always necessary. You can disable RTTI in your application by adding the following lines to each unit:
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
But to completely disable RTTI, you need to add these lines to used RTL units too, and rebuild the project.
How much will the size of the executable file decrease? Well, I checked it on small utilities from the Delphi Localizer project, and here is the result:
kdlscan.exe was 742400 bytes, now 360448 bytes, -51%
lngupdate.exe was 727040 bytes, now 282112 bytes, -61% (!!!)
The smaller size of an executable file means that the file is read twice as fast from disk. In addition, the processor is more likely to be able to fully fit your utility into its cache. You can give other reasons why this makes sense.
@KodeZwerg First, read the remark from Stefan Glienke above.
Advanced RTTI available in Delphi since version 2010. So applications compiled in Delphi 5 do not contain it.
Yes it is. You can find the complete list of units contained in your application in the PACKAGEINFO resource in your executable file. Use a resource viewer to access it, for ex. Restorator.
There is BuildWinRTL.dproj in source\rtl. You can copy the RTL folder to your work folder, inject the code to disable RTTI in every used PAS file, check Search path and Unit output directory (instead of "$(BDSCOMMONDIR)\lib\$(Platform)" you can set "..\lib\$(Platform)"), check build configuration (Release, Win32) and rebuild the BuildWinRTL project. You'll find DCU files in the lib\Win32 folder.
In case you use any other VCL units and third-party libraries you should inject the code in every PAS file of these libraries too, to remove RTTI completely. Copy the used VCL units to a separate folder in your working folder, do not modify the files in the Source folder of Delphi.
Make sure your application’s search path for the Release build configuration points to the recompiled DCU files of RTL, and to modified PAS files of VCL. Now you are ready to compile your application without RTTI.