Jump to content

Vincent Parrett

Members
  • Content Count

    721
  • Joined

  • Last visited

  • Days Won

    53

Everything posted by Vincent Parrett

  1. Vincent Parrett

    I will be less active for a few weeks

    That might be so, but you probably have a bunch of covid in the community too.. I'll stay down under where it's under control at the moment πŸ˜‰
  2. Vincent Parrett

    I will be less active for a few weeks

    Bugger, sorry to hear that, hope you are well on the mend! We've been extremely fortunate here and haven't had a community transmission case for quite some time (at least where I live). Being an island and closing the borders helped immensely. The vaccine rollout is very slow, I can't get it till end of May last I heard (lack of supply).
  3. Vincent Parrett

    Decrease Your Build Time

    Using precompiled dcu's is common sense really.. imagine if you had to build the rtl/vcl/fmx every time you build your application⏲️ In the dpm package manager I'm, working on, it compiles the packages/library when the library is installed (assuming its designed to do that) - so the first time you install the package it takes a bit longer, but then builds are a lot faster.
  4. Vincent Parrett

    List of usable RegEx for source code

    As the old saying goes, used regex to solve a problem? now you have two problems! 🀣 That said, I use regex extensively both in Delphi (I wrote the original System.RegularExpressions code) and .Net (keep it simple, and it's not for parsing html!) - but using it to find problems with my code? ah nope, for that I use Eyeballs 1.0 and static analysis tools like FixInsight and Pascal Analyzer (yes I know they have their limitations). Plus I guess I have learned a few things over the years that I apply in new code I write. As for the old code, well refactoring is a work in progress. Yesterday I rewrote a lexer/parser framework I initially wrote 10 years ago due to performance issues, and that issue was identified through profiling (see the thread on vtune). Switching to records took the memory manager from being a big % to insignificant (ie no longer shows up in the profiler). I thought I might get something like a 10% improvement, but was pleasantly surprised to see a 30% improvement! Those sort of gains don't come often in a mature code base.
  5. Vincent Parrett

    MAP2PDB - Profiling with VTune

    I just had my first big win with VTune πŸ˜ƒ I was looking into improving the performance of loading projects in FinalBuilder 9 (in dev) - we have some customers with huge projects that were taking a while to load. Profiling with VTune showed that most of the time was spent in the project lexer/parser - the lexer created class based tokens (and some other associated classes) and a lot of time was spent in the lexer and the memory manager. So 3 hours later, the code has been converted to use records rather than classes - the unit tests all pass (I only had to comment out all the Assert.IsNotNull(token); calls) and the application runs normally (still need to code review to make sure I didn't break things). The result is around a 30% improvement with that change alone! That's just me counting out loud as the project loads πŸ˜‰ - I'll do more formal timing/testing tomorrow. I also just compared to FinalBuilder 8 and the total improvement is more like 60% - I'll put that down to some manual code review looking for possible hotspots over the last week, and also to switching from the rtl generic collections to using spring4d everywhere! Time for some sleep, but looking forward to more VTuning tomorrow. Thanks @Anders Melander again for this amazing bit of work!
  6. Vincent Parrett

    MAP2PDB - Profiling with VTune

    I recreated the dproj file and now it works.. gotta love the mess that is dproj files upgraded through multiple delphi versions πŸ™„
  7. Vincent Parrett

    MAP2PDB - Profiling with VTune

    Weird since the file is definitely being compiled with debug info. I added this to test {$IFOPT D+} Well debug info is turned on so this should not compile {$ENDIF} and it hits the error. I'll investigate further.
  8. Vincent Parrett

    MAP2PDB - Profiling with VTune

    This is an odd one, the package is compiled with debug info etc, but I get this output : :\map2pdb>map2pdb.exe I:\FBAT_HG9\Output\FB9\VSoft.Core.DB.map -bind:I:\FBAT_HG9\Output\FB9\VSoft.Core.DB.bpl -v map2pdb - Copyright (c) 2021 Anders Melander Version 2.0 Constructed a new PDB GUID: {B1FCFCB0-3F09-4207-BB64-0D1D08101C3F} Output filename not specified. Defaulting to VSoft.Core.DB.pdb Reading MAP file - Segments Warning: [ 7] Empty segment: .tls [0005:00000000] Warning: [ 8] Empty segment: .pdata [0006:00400000] - Modules Warning: [ 791] Module exceed segment bounds - ignored: nxllConst [0005:00000000+4] Warning: [ 792] Module exceed segment bounds - ignored: nxllSync [0005:00000004+12] Warning: [ 793] Module exceed segment bounds - ignored: nxllUtils [0005:00000010+8] Warning: [ 794] Module exceed segment bounds - ignored: nxllException [0005:00000018+12] Warning: [ 795] Module exceed segment bounds - ignored: nxllPlatformInterface [0005:00000024+4] Warning: [ 796] Module exceed segment bounds - ignored: nxsdDataDictionary [0005:00000028+4] Warning: [ 797] Module exceed segment bounds - ignored: nxsdServerEngine [0005:0000002C+4] Warning: [ 798] Module exceed segment bounds - ignored: nxsrFileImplWin32 [0005:00000030+8] Warning: [ 799] Module exceed segment bounds - ignored: nxsrTimeoutHandling [0005:00000038+56] Warning: [ 800] Module exceed segment bounds - ignored: nxseHeapEngineCached [0005:00000070+4] Warning: [ 801] Module exceed segment bounds - ignored: nxsrServerEngine [0005:00000074+4] Warning: [ 802] Module exceed segment bounds - ignored: nxllTransport [0005:00000078+4] Warning: [ 803] Module exceed segment bounds - ignored: nxrbCallContext [0005:0000007C+4] Warning: [ 804] Module exceed segment bounds - ignored: nxptBasePooledTransport [0005:00000080+24] Warning: [ 805] Module exceed segment bounds - ignored: nxsqlTableExp [0005:00000098+4] Warning: [ 806] Module exceed segment bounds - ignored: nxsqlCondExp [0005:0000009C+4] Warning: [ 807] Module exceed segment bounds - ignored: nxsqlProxies [0005:000000A0+4] Warning: [ 808] Module exceed segment bounds - ignored: nxdb [0005:000000A4+4] Warning: [ 809] Module exceed segment bounds - ignored: nxllSocket [0005:000000A8+4] - Symbols Warning: [ 2213] Failed to resolve symbol to module: [0005:000000A4] nxdb._nxDefaultSession Warning: [ 3236] Failed to resolve symbol to module: [0005:00000000] nxllConst._CurrentThreadNxVersion Warning: [ 3391] Failed to resolve symbol to module: [0005:00000020] nxllException._CurrentExceptionHookInfo Warning: [ 3395] Failed to resolve symbol to module: [0005:00000018] nxllException._LastError Warning: [ 3396] Failed to resolve symbol to module: [0005:0000001C] nxllException._LastMessage Warning: [ 4052] Failed to resolve symbol to module: [0005:00000024] nxllPlatformInterface.nxIsUIThread Warning: [ 4216] Failed to resolve symbol to module: [0005:000000A8] nxllSocket.SocketErrorProc Warning: [ 4455] Failed to resolve symbol to module: [0005:00000008] nxllSync.nxtv_BreathCallback Warning: [ 4649] Failed to resolve symbol to module: [0005:00000078] nxllTransport.nxitvTransport Warning: [ 4990] Failed to resolve symbol to module: [0005:00000014] nxllUtils._ThreadCodePage Warning: [ 4991] Failed to resolve symbol to module: [0005:00000010] nxllUtils._ThreadLocale Warning: [ 5545] Failed to resolve symbol to module: [0005:00000080] nxptBasePooledTransport.nxitvReplyInfos Warning: [ 5732] Failed to resolve symbol to module: [0005:00000090] nxptBasePooledTransport._Interval Warning: [ 5733] Failed to resolve symbol to module: [0005:00000094] nxptBasePooledTransport._Mask Warning: [ 5734] Failed to resolve symbol to module: [0005:00000088] nxptBasePooledTransport._NetIdle Warning: [ 5757] Failed to resolve symbol to module: [0005:0000007C] nxrbCallContext._CurrentCallContext Warning: [ 7123] Failed to resolve symbol to module: [0005:00000028] nxsdDataDictionary._DontLoadID Warning: [ 9598] Failed to resolve symbol to module: [0005:0000002C] nxsdServerEngine._SessionStatsCurrent Warning: [10232] Failed to resolve symbol to module: [0005:00000070] nxseHeapEngineCached._FindBlockNumber Warning: [12890] Failed to resolve symbol to module: [0005:0000009C] nxsqlCondExp._CurrentlyProcessedContains Warning: [14747] Failed to resolve symbol to module: [0005:000000A0] nxsqlProxies.nxsqlNoProcessingCounter Warning: [16463] Failed to resolve symbol to module: [0005:00000098] nxsqlTableExp._LockUnbindIfRequired Warning: [17204] Failed to resolve symbol to module: [0005:00000030] nxsrFileImplWin32.FileBlocks Warning: [17207] Failed to resolve symbol to module: [0005:00000034] nxsrFileImplWin32.HighestBlock Warning: [18261] Failed to resolve symbol to module: [0005:00000074] nxsrServerEngine._ForRecover Warning: [18471] Failed to resolve symbol to module: [0005:00000038] nxsrTimeoutHandling.nxtv_TimeoutHandling Warning: [18617] Failed to resolve symbol to module: [0005:000000AC] SysInit.TlsLast Warning: [18621] Failed to resolve symbol to module: [0004:FFC91000] SysInit.__ImageBase - Line numbers Constructing PDB file - Collecting source file names - Module streams - Strings stream - PDB Info stream - TPI stream - Symbols stream - DBI stream - IPI stream - Finalizing PDB file Patching PE file - PE32 image (32-bit) Image does not contain a debug directory address - please link with debug info enabled bpl, map and pdb attached. VSoft_Core.DB.zip
  9. Vincent Parrett

    MAP2PDB - Profiling with VTune

    Agree, there is already a few issues asking for pdb support that have lots of votes and have been open for years. @Marco Cantu @David Millington FYI.
  10. Vincent Parrett

    MAP2PDB - Profiling with VTune

    Well that's what happens when you strip the team down to the bare bones and then hire short term contractors, maintaining things becomes a problem when your teams domain knowledge is low. FWIW, 5 minutes in and I already fixed a perf issue in the area that I have been trying to optimise for the last week (replaced a list with a hashset) - a small win but I'll take any win I can get right nowπŸ˜ƒ Pity embarcadero don't ship map files for their bpl's - hmmm will log a qc for that - because as I dig deeper into my perf issues I end up in the weeds in rtl etc with func@xxx a lot.
  11. Vincent Parrett

    MAP2PDB - Profiling with VTune

    It wasn't that, and I probably did forget the bind switch before I sent it to you, however with the new version.... we have lift off! Awesome work! E:\map2pdb>map2pdb.exe I:\FBAT_HG9\Output\FB9\FinalBuilder9.map -v -bind:I:\FBAT_HG9\Output\FB9\FinalBuilder9.exe map2pdb - Copyright (c) 2021 Anders Melander Version 2.0 Constructed a new PDB GUID: {CE1E6D08-67E6-4B5B-B42A-3FC719254F1E} Output filename not specified. Defaulting to FinalBuilder9.pdb Reading MAP file - Segments Warning: [ 8] Empty segment: .pdata [0006:00400000] - Modules - Symbols Warning: [20671] Failed to resolve symbol to module: [0005:00000608] SysInit.TlsLast Warning: [20673] Failed to resolve symbol to module: [0004:FF77A000] SysInit.__ImageBase - Line numbers Warning: [71563] Line number with zero offset ignored. Module:VSoft.IDE.Types, Segment:0001, Source:VSoft.IDE.Types.pas, Line:49 Warning: [71567] Line number with zero offset ignored. Module:VSoft.IDE.Interfaces, Segment:0001, Source:VSoft.IDE.Interfaces.pas, Line:328 Warning: [75481] Line number with zero offset ignored. Module:LMDRTLConst, Segment:0001, Source:LMDRTLConst.pas, Line:213 Warning: [75621] Line number with zero offset ignored. Module:intfLMDBase, Segment:0001, Source:intfLMDBase.pas, Line:44 Warning: [76980] Line number with zero offset ignored. Module:LMDDckCst, Segment:0001, Source:LMDDckCst.pas, Line:29 Warning: [79649] Line number with zero offset ignored. Module:VSoft.IDE.ActionListInterfaces, Segment:0001, Source:VSoft.IDE.ActionListInterfaces.pas, Line:136 Warning: [90056] Line number with zero offset ignored. Module:SynEditStrConst, Segment:0001, Source:SynEditStrConst.pas, Line:577 Warning: [98436] Line number with zero offset ignored. Module:VSoft.IDE.WizardManagerService, Segment:0001, Source:VSoft.IDE.WizardManagerService.pas, Line:61 Warning: [99799] Line number with zero offset ignored. Module:dwTaskbarList, Segment:0001, Source:dwTaskbarList.pas, Line:213 Warning: [103835] Line number with zero offset ignored. Module:RestException, Segment:0001, Source:RestException.pas, Line:26 Warning: [105461] Line number with zero offset ignored. Module:VSoft.Shared.UXLControlIntf, Segment:0001, Source:VSoft.Shared.UXLControlIntf.pas, Line:60 Warning: [107033] Line number with zero offset ignored. Module:VSoft.IDE.MS.ActionCollection.Interfaces, Segment:0001, Source:VSoft.IDE.MS.ActionCollection.Interfaces.pas, Line:1085 Constructing PDB file - Collecting source file names - Module streams - Strings stream - PDB Info stream - TPI stream - Symbols stream - DBI stream - IPI stream - Finalizing PDB file Patching PE file - PE32 image (32-bit) - PDB file name has been stored in debug data. - Header checksum has been cleared. - PE file has been updated. I was also able to create a pdb for the package E:\map2pdb>map2pdb.exe I:\FBAT_HG9\Output\FB9\VSoft.Core.map -bind:I:\FBAT_HG9\Output\FB9\VSoft.Core.bpl -v map2pdb - Copyright (c) 2021 Anders Melander Version 2.0 Constructed a new PDB GUID: {76323C0F-0787-44F8-BC72-2B6ACC9CBF82} Output filename not specified. Defaulting to VSoft.Core.pdb Reading MAP file - Segments Warning: [ 7] Empty segment: .tls [0005:00000000] Warning: [ 8] Empty segment: .pdata [0006:00400000] - Modules Warning: [ 1682] Module exceed segment bounds - ignored: OtlCommon.Utils [0005:00000000+256] - Symbols Warning: [ 6403] Failed to resolve symbol to module: [0005:00000000] OtlCommon.Utils.LastThreadName Warning: [ 8705] Failed to resolve symbol to module: [0005:00000100] SysInit.TlsLast Warning: [ 8709] Failed to resolve symbol to module: [0004:FFBF8000] SysInit.__ImageBase - Line numbers Warning: [64147] Line number offset out of range for module. Offset:003DAEEF, Module:.VSoft.Core [003DAEF0 - 003E5738] Constructing PDB file - Collecting source file names - Module streams - Strings stream - PDB Info stream - TPI stream - Symbols stream - DBI stream - IPI stream - Finalizing PDB file Patching PE file - PE32 image (32-bit) - PDB file name has been stored in debug data. - Header checksum has been cleared. - PE file has been updated. Now to hook it into every project in the group and see how it goes πŸ˜ƒ Thanks again for this awesome effort.. my only question now is, if you can do this in your spare time, why TF can't embarcadero do it πŸ™„
  12. Vincent Parrett

    MAP2PDB - Profiling with VTune

    I compiled map2pdb from source using 10.4.2 and vtune now loads the pdb from the test project. Sadly it didn't work for my real application Cannot locate debugging information for file 'I:\FBAT_HG9\Output\FB9\FinalBuilder9.exe'. Cannot match the module with the symbol file 'I:\FBAT_HG9\Output\FB9\FinalBuilder9.pdb'. Make sure to specify the correct path to the symbol file in the Binary/Symbol Search list of directories.
  13. Vincent Parrett

    MAP2PDB - Profiling with VTune

    Well I tried the same project with 10.3 and got the same result, so it's not the compiler version. I'm using Vtune 2021.1.1 Gold - perhaps it's the vtune version?
  14. Vincent Parrett

    MAP2PDB - Profiling with VTune

    I suspect this has to do with the compiler version, using 10.4.2 even the test console app doesn't show function names. Project3.zip
  15. Vincent Parrett

    MAP2PDB - Profiling with VTune

    I have pm'd the map file, I didn't have your email address handy.
  16. Vincent Parrett

    MAP2PDB - Profiling with VTune

    I was seriously excited about this, until I realized I don't really know how to drive vtune πŸ™„ (terrible user interface!). So I was able to generate a pdb (9.5MB) and it appears to bind, however when running with vtune I don't see function names CPU Time 1 of 1: 100.0% (0.010s of 0.010s) FinalBuilder9.exe ! func@0x77c258 - [unknown source file] FinalBuilder9.exe ! func@0x4de4bf + 0xca - [unknown source file] FinalBuilder9.exe ! func@0x4ea8f8 + 0x176 - [unknown source file] FinalBuilder9.exe ! func@0x4ea518 + 0x10c - [unknown source file] FinalBuilder9.exe ! func@0x4ea8f8 + 0xf5 - [unknown source file] FinalBuilder9.exe ! func@0x4ea518 + 0x10c - [unknown source file] FinalBuilder9.exe ! func@0x4ea8f8 + 0xf5 - [unknown source file] FinalBuilder9.exe ! func@0x4ea518 + 0x10c - [unknown source file] FinalBuilder9.exe ! func@0x4ea8f8 + 0xf5 - [unknown source file] FinalBuilder9.exe ! func@0x4ea518 + 0x10c - [unknown source file] ..... How can I see if vtune is actually using the pdb? Also I'm using runtime packages, however when I tried to create a pdb for packages map2pdb crashed E:\map2pdb>map2pdb.exe I:\FBAT_HG9\Output\FB9\VSoft.Core.map -bind:I:\FBAT_HG9\Output\FB9\VSoft.Core.bpl -v map2pdb - Copyright (c) 2021 Anders Melander Version 2.0 Output filename not specified. Defaulting to VSoft.Core.pdb Reading MAP file - Segments - Modules An error occurred in the application. date/time : 2021-04-04, 08:53:18, 171ms computer name : SR22 user name : vincent registered owner : Vincent operating system : Windows 10 x64 build 19042 system language : English system up time : 42 minutes 16 seconds program up time : 185 milliseconds processors : 8x Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz physical memory : 52813/65477 MB (free/total) free disk space : (C:) 78.24 GB (E:) 233.56 GB display mode : 2560x1440, 32 bit process id : $55d0 allocated memory : 118.39 MB largest free block : 1.47 GB command line : map2pdb.exe I:\FBAT_HG9\Output\FB9\VSoft.Core.map -bind:I:\FBAT_HG9\Output\FB9\VSoft.Core.bpl -v executable : map2pdb.exe exec. date/time : 2021-04-04 08:00 compiled with : Delphi 10.3 Rio madExcept version : 5.1.0 callstack crc : $7846b8db, $f263fd00, $f263fd00 exception number : 1 exception class : EArgumentOutOfRangeException exception message : Argument out of range. thread $5a5c: 0046c541 +029 map2pdb.exe debug.info TDebugInfoSegments.FindByIndex 0047e90f +58b map2pdb.exe debug.info.reader.map TDebugInfoMapReader.LoadFromStream 0047d844 +034 map2pdb.exe debug.info.reader TDebugInfoReader.LoadFromFile 004aa13e +2e6 map2pdb.exe map2pdb 140 +62 initialization 76dffa27 +017 KERNEL32.DLL BaseThreadInitThunk thread $5c8: 76dffa27 +17 KERNEL32.DLL BaseThreadInitThunk thread $55d8: 76dffa27 +17 KERNEL32.DLL BaseThreadInitThunk thread $5b2c: 76dffa27 +17 KERNEL32.DLL BaseThreadInitThunk thread $4fac: 76dffa27 +17 KERNEL32.DLL BaseThreadInitThunk thread $5bc0: 76dffa27 +17 KERNEL32.DLL BaseThreadInitThunk
  17. It's not that I don't care for it, I just don't have the time (or skills for it). Happy to look at contributions to achieve this. I do know there are some issues with constructor overloads that would need to be addressed.
  18. Ok, that's news to me (DUnitX author). πŸ˜‰
  19. Vincent Parrett

    VCL Handling of dpi changes - poor performance

    Yes, the project started in Delphi 5, been upgraded a few times over the years, so not sure when that property was set but it did take a while to figure out what was going on.
  20. Vincent Parrett

    VCL Handling of dpi changes - poor performance

    Just a word of warning about setting ParentFont := true - I had ParentFont := true on a base form class and this completely disabled scaling on all the descendant forms! This just took me an hour of messing around to reproduce in a test project. I have no idea why ParentFont was set on that form - the project is 20yrs old and I've changed version control several times over the years so couldn't find the commit where that was set. Not sure if this is expected behaviour on forms or a bug.
  21. Vincent Parrett

    VCL Handling of dpi changes - poor performance

    You would think so, however, VCL Styles were added in XE2 and I think it wasn't until 10.3 they were added to the IDE, and even then the IDE is using custom themes (notice we can't just select any vcl theme). So they don't have a great track record of dogfooding new features.
  22. Vincent Parrett

    Determining why Delphi App Hangs

    @ewong You should not, under any circumstances, update vcl controls in a thread other than the main thread. If it's just updating a progress bar, you can do that quite simply by using PostMessage and send a user message to the form https://www.cryer.co.uk/brian/delphi/howto_send_custom_window_message.htm Use PostMessage (non blocking) rather than SendMessage (blocking). Working with threads in Delphi is harder than it needs to be. I recommend taking a look at https://github.com/gabr42/OmniThreadLibrary I also created a nice wrapper for omnithread that makes running tasks in background threads really simple : https://github.com/VSoftTechnologies/VSoft.Awaitable I've been using this in my projects for a while now (I was already using OmniThread) and it makes things so much simpler!
  23. Vincent Parrett

    Introducing Delphi Uses Helper

    And I have to say, Why TF isn't something like this built into the IDE?? Nice work. It almost feels like I'm using visual studio 2012 I ended up using Shift+Ctrl+U as the shortcut so I never have to see the crappy default one - which I accidently invoked a few times now. Now for the first feature request πŸ˜‰. Can you index my project search path? I just tried to us it to add Spring.Collections - but that is installed via dpm - so it's on my search path (via an msbuild property). This tool as a ton of potential... I know you don't have the time to work on it but others might, if you put it on github πŸ˜‰
  24. Vincent Parrett

    Introducing Delphi Uses Helper

    Huh, restarted the IDE again (third time) and now it works. Nice!
  25. Vincent Parrett

    Introducing Delphi Uses Helper

    I tried, but cannot get it to show. Shift+Ctr+A just locks the IDE for about 20 seconds and then the default uses thingy (I forgot how bad it is) shows. I tried changing the shortcut but then nothing happens. Testing with 10.4.2
Γ—