Jump to content

Kryvich

Members
  • Content Count

    279
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Kryvich

  1. Once I make a utility that the user ran from a network drive. Moreover, it was launched many times during the day to process incoming documents. Then they asked me to make the EXE file as small as possible to speed up the processing. Removing RTTI from the executable file has greatly accelerated the workflow.
  2. @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.
  3. Kryvich

    Releasing memory devoted to arrays

    @Gary Mugford The assignment "VPP := 0;" right before the second assignment you can delete. Actually the compiler must generate a hint: H2077 Value assigned to 'VPP' never used. Check the Messages view after compilation: there may be other hints and warnings. You can ensure that the fields have proper values by inserting assertions right before the assignment: Assert((fieldByName('Parm1').AsFloat >= 0.00002) and (fieldByName('Parm1').AsFloat <= 20), 'Bad Parm1 value: ' + fieldByName('Parm1').AsString); Assert((fieldByName('ParmBV').AsFloat >= 200) and (fieldByName('ParmBV').AsFloat <= 500), 'Bad ParmBV value: ' + fieldByName('ParmBV').AsString); I myself often use assertions at the beginning of a method to make sure that input parameters are correct. You can leave them in the code, because assertions usually do not affect performance of an application.
  4. I found a few more units with RTTI and was able to further reduce the utilities from the Localizer project. Now the numbers are: kdlscan.exe was 742 400 bytes, now 355 840 bytes, -52% lngupdate.exe was 727 040 bytes, now 277 504 bytes, -62% I also tested one of my applications with and without RTTI. Application: Windows 32-bit utility, VCL, memory tables, RichEdit components, string processing. I measured only the speed of text processing, not the speed of launching the application. I have to say, in my case there is no gain in performance after the removal of RTTI. Test Application Executable File Size, bytes Processing time, best run, s RTTI enabled 4 777 472 62 RTTI disabled 3 300 864 61 Difference, % -31% -2% Probably, the tested program is too small, and can fit in the processor's cache entirely in both cases.
  5. Kryvich

    Releasing memory devoted to arrays

    If you decide to go with TDictionary<string, TYourData>, here is examples how to create, initialize, use and free it: http://docwiki.embarcadero.com/CodeExamples/Tokyo/en/Talk:Generics_Collections_TDictionary_(Delphi).
  6. Kryvich

    Releasing memory devoted to arrays

    First of all, you need to set your build configuration to Debug (Projects view | Build Configurations - double click Debug), and enable debugging options (menu Project | Options | Building | Delphi Compiler | Compiling): Optimization: False Stack Frames: True Debugging: all settings to True Runtime errors: all 3 settings to True Perhaps after that this error will appear earlier than when you close the application. Usually you do not need to initialize arrays - they are initialized with zeros automatically. How the arDeptsTotal array is declared? Is it 0-based or 1-based? Based on the code snippets you provided, the TList<TYourData> or TDictionary<string, TYourData> class might be more appropriate for you. But the good old array should works too.
  7. @Lars Fosdal RTTI can be selectively enabled for the classes that really need it.
  8. Is it affect programs, written in Unicode enabled Delphi versions (Delphi 2009 and above)?
  9. @David Heffernan How you think: is RTTI information concentrated in one place of an executable file, or scattered around it? Open any EXE file and find the answer. I would prefer that the RTTI information be in a separate segment (resource) of the EXE file, and preferably in a separate file. But you are right about performance: it is better to test, and then draw conclusions.
  10. @stijnsanders I do not know such special settings. But you can use conditional compiler directives to leave RTTI for the Debug build: {$IFDEF RELEASE} {$WEAKLINKRTTI ON} {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])} {$ENDIF}
  11. @Bill Meyer That's the whole point: if Embarcadero can get the IDE to work on a such project, then CodeInsight will work flawlessly on projects with a well-designed architecture.
  12. A memory table with indexing and filtering (Filter := "like 'bl*'") would help. If you haven't TkbmMemTable, there is TFDMemTable and TClientDataSet even in the Community Edition. Use BeginBatch, EndBatch to speed up the loading. Of course, you can write a low level code and try to squeeze the maximum speed, as advised above.
  13. Kryvich

    MvmStartKit now supports 10.3 Rio

    I tried MvvmStarterKit\Demo\VCL\MVVMDemo.dproj in Delphi 10.3. TYPE_KIND_TO_VALUE_TYPE should be appended with TgoValueType.Unsupported); // tkMRecord Demo program has memory leaks. The latest commit to https://github.com/DelphiPraxis/MvvmStarterKit dated October, 9. I suppose you forgot to push your Delphi 10.3 update to GitHub.
  14. Kryvich

    Releasing memory devoted to arrays

    A demo program that demonstrates the bug would help the community to help you.
  15. Kryvich

    mORMot running on Delphi 10.3 Rio

    So now (among other) we have FireDAC - a DAC for Delphi packed with advanced features, and the lightning fast Zeos - a free and open source lib. Both libraries can work in conjunction with mORMot. Having a choice is always good.
  16. It takes time to update and test all components in Delphi 10.3. In GetIt in 10.2, I see 202 packages right now, and in 10.3 - 55 packages (at the start it was 34).
  17. Alternatively you can try a memory table and compare it with TStringList. I recommend TkbmMemTable.
  18. Kryvich

    MvmStartKit now supports 10.3 Rio

    What is the difference between this kit and https://github.com/grijjy/MvvmStarterKit, in short?
  19. Kryvich

    mORMot running on Delphi 10.3 Rio

    The Zeos test results are astounding. What about the capabilities of this library? Does it support the on-demand rows fetching, rows pagination, delayed fetching (to postpone a BLOB and nested datasets loading)? FireDAC can do it: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Fetching_Rows_(FireDAC)
  20. Very good library to test the CodeInsight and ErrorInsight features.
  21. Kryvich

    Rio has a broken REST Library

    As I understand WinHttpQueryHeaders should return an Unicode string, so LSize should be even. But we can foresee any variant, allocating enough space for the result string: SetLength(Result, (LSize+1) div SizeOf(Char));
  22. Kryvich

    Rio has a broken REST Library

    Before the second call of WinHttpQueryHeaders there is a check: if GetLastError <> ERROR_INSUFFICIENT_BUFFER then raise ENetHTTPException.CreateResFmt(...); It means that the call of function WinHttpQueryHeaders occurs only if GetLastError = ERROR_INSUFFICIENT_BUFFER. According to the API: If the function fails and ERROR_INSUFFICIENT_BUFFER is returned, lpdwBufferLengthspecifies the number of bytes that the application must allocate to receive the string.
  23. Kryvich

    GetIt pkg mgr problems

    @FredS No, it din't work for me. Can you find CodeSiteExpressPkg260.bpl in "c:\Program Files (x86)\Raize\CS5\Bin" ? Update: I found this file here: "c:\Program Files (x86)\Raize\CS5\Deploy\Win32\", copied it to "c:\Program Files (x86)\Raize\CS5\Bin" and now CodeSite works! https://quality.embarcadero.com/browse/RSP-21763
  24. I used the Migration Tool to move my syntax highlighting from 10.2.3 to 10.3.
  25. Kryvich

    Rio has a broken REST Library

    Weird. Waiting for your findings. The good thing is that CE comes with REST sources, so a competent enthusiast can help find a bug in the library.
×