Guest Posted November 25, 2020 OK, me again in a needy mood ... I tried to search here and there and... somewhere... but. I am looking for resources pointing to a "modus" to first off measure what takes what time when my exe is loaded. So some kind of writeup of the different stages and dfm-resources and other resources. Or perhaps using a profiler and understanding what it reports. Then after having mapped "sections/scopes/what-not" during application load, i would like to move on to resources with hints on what can be done. Of course, for such endeavours some properties are significant about the project itself: VCL 32/64 bit DevExpress BarManager/Ribbon/Layoutcontrol/GridViews/PivitGrids/Skinning/Scrolling/Painting and then some... FastReports... RTC... IBObjects (think a really tight and well working FireDAC with sources but only for FB/IB)... madExcept... kbmMemTable... I think those are the focus points in this project. TIA, /Dany Share this post Link to post
Der schöne Günther 316 Posted November 25, 2020 A "profiler" does exactly just that. Have you fed "delphi profiler" into a search engine of your choice? 1 Share this post Link to post
Guest Posted November 25, 2020 (edited) 3 hours ago, Der schöne Günther said: A "profiler" does exactly just that. Have you fed "delphi profiler" into a search engine of your choice? No, because i'll have to interpret all that stuff. My post is about resources for interpreting all that. I suspect i could create a ticket with DX but generally such questions are not treated with... umpf! Or to put my post differently, where do i focus? Where do i start in order not to loose days on useless stuff? I'll start with a profiler, thanks! Edited November 25, 2020 by Guest profiler Share this post Link to post
Mike Torrettinni 198 Posted November 25, 2020 Not sure if this is of any value in your case, but I remember analyzing Process Monitor log and discovering my exe unnecessary accessing/or repeated opening, closing Registry (instead of open once and access and close when not used anymore). I also discovered it was trying accessing some non-existent files on the disk, causing slow load/start time. This was not very clear at analyzing source. https://docs.microsoft.com/en-us/sysinternals/downloads/procmon 1 Share this post Link to post
Stefan Glienke 2009 Posted November 25, 2020 (edited) SamplingProfiler usually gives a good overview to find the particularly time consuming parts. (although it says up to XE4 on that page it works just fine for up to 10.4) Edited November 25, 2020 by Stefan Glienke 1 Share this post Link to post
Lars Fosdal 1792 Posted November 26, 2020 Rule #1 - Don't do shit before your application has loaded and displayed itself. After the initial display, you can show various "Preparing good stuff - % complete" messages and do stuff in threads, allowing basic interaction with the app - such as doing an immediate exit. Speed is mostly about perception. 4 Share this post Link to post
Anders Melander 1795 Posted November 26, 2020 52 minutes ago, Lars Fosdal said: Rule #1 - Don't do shit I usually wait until after my morning coffee. 52 minutes ago, Lars Fosdal said: Speed is mostly about perception. Very good point. Few people enjoy watching paint dry - unless it's body paint I have "solved" quite a few performance problems simply by adding a splash screen and/or a progress bars. Share this post Link to post
Guest Posted November 26, 2020 59 minutes ago, Lars Fosdal said: Rule #1 - Don't do shit before your application has loaded and displayed itself. Why is that ? What if the application need to parse folders for files, decompress or preload resources...or even connect to some server, must i leave the application to show then start doing this, or can i start do this in the background ? What i am trying to say is this thing, when trying to start doing something, is depends on what the application does, but i disagree on such rule. @Dany Marmur I use Nexus Quality suit Method Timer to get an idea where time been spend. Share this post Link to post
Lars Fosdal 1792 Posted November 26, 2020 Why? Because not seeing the application work is easy to confuse with seeing the application not working. 1 Share this post Link to post
Guest Posted November 26, 2020 3 hours ago, Lars Fosdal said: Speed is mostly about perception. The hoops and loops these days... just take a look at Teams; mostly animations to make the viewer think thing are fast. Illusions. Share this post Link to post
Guest Posted November 26, 2020 (edited) 2 hours ago, Kas Ob. said: pplication need to parse folders for files, decompress or preload resources.. It's my app. I know that shit intimately... i wrote it all. The post is not about those things. Edited November 26, 2020 by Guest Share this post Link to post
Guest Posted November 26, 2020 (edited) 2 hours ago, Kas Ob. said: Nexus Quality suit Method Time Same pointer/advice as have been stated already in the second comment (hr. Gunther). Edited November 26, 2020 by Guest Share this post Link to post
Mahdi Safsafi 225 Posted November 26, 2020 Do you use any dlls other than system dll ? Share this post Link to post
Clément 148 Posted November 26, 2020 Since your concern is about startup time, there's a very handy way to find the culprit: Comment your code. All the objects( data modules, forms, classes ) created before the "application.run" should be checked for "legacy code not required anymore" If your project starts creating only the main form, then check the constructor and show form. And don't be shy! comment everything! even assignments (you never know what a setter might be doing) You will find out some leftovers from the past, that made perfect sense last decade, that are no longer required. The library you are using are among the best in delphi ecosystem, but... since you mention IBObjects, and FireDac, are you sure there's no query being executed at startup? DB Stuff might usually be rather slow, specially if some event's are alive during startup! 1 Share this post Link to post
Rollo62 538 Posted November 27, 2020 (edited) 19 hours ago, Kas Ob. said: Why is that ? I focused a lot to mobile development, but those concepts were also good for desktop IMHO. Since many years I use "lazy initialization" on startup, this keeps the EXE slim and fast, no need for ugly splash-screens. Then after FormShow I see the app, and can do some lazy configurations, and provide a nice display, if needed. Most of the time these configurations were faster than the user clicks, so its not recognizable to most users. This way customer see its starting and working fast, and they don't complain, I think big splash screen is more annoying. Even a disabled app, during "lazy configuration" feels a lot faster than if you do this before the app is visible. I think time is relative, if the user sees some reactions from time to time, this is squeezing time&space a lot, like a warp drive. Another advantage of lazy initialization is, your app is already under full control. Errors, exceptions, logs, etc. can be much better debugged in this state, while during the fragile startup phase. Edited November 27, 2020 by Rollo62 Share this post Link to post
Guest Posted November 27, 2020 @Rollo62 I can't agree more, when i disagreed with Lars is about making it as Rule. Your point about errors, exceptions, logs..etc is completely valid and no one will argue with that, but not every application should follow such rule, example imagine opening Windows Task Manager and it does show an empty window then fill the information gradually, in other words some application are meant to be used for less than 1 minute, for me and such application it is a sin to waste 1 second delaying full functionality or at least most functionality online and ready for user action. I hate splash screen and rarely use them, away from that all users like it snappy and ready for action, of course some application might need a login, then this will simplify everything, then later the client ask for auto login with saved credential for faster online time, then i will skip login form and perform the login as sooner as possible to establish the secure connection while opening last opened windows by the user. Share this post Link to post
Rollo62 538 Posted November 27, 2020 58 minutes ago, Kas Ob. said: imagine opening Windows Task Manager and it does show an empty window then fill the information gradually, in other words some application are meant to be used for less than 1 minute, for me and such application it is a sin to waste 1 second delaying full functionality. Maybe your argument is right for some kind of apps, maybe command-line like, but WindowsTaskManager is probably not a good example IMHO. When I press CtrlAltDel, and then need waiting so long until anything happens, I personaly would prefer the directly responding display, and maybe gradually populating Tast Manager. I think what all people give bad mood at PCs comes from to "trigger any action", and then wait unreasonably long to see any result, giving impression somethings wrong. Very often I press buttons twice, just because of that, and ran into other nasty issues then. This is what we try to target by responsiveness, by keeping things in threads instead of UI. I prefer the full responsiveness over saving some seconds here or there. Imagine the Windows Task Manager, gradually populating, this by chance has listed your desired process immediately at the top, and you can work with that already, while the others are still populating. If your not lucky, and your process is the last in the list, at least this is understandable, and you got a nice progress display. I find this less annoying. Share this post Link to post
Lars Fosdal 1792 Posted November 27, 2020 1 hour ago, Kas Ob. said: imagine opening Windows Task Manager and it does show an empty window then fill the information gradually Actually, it does work that way. First the window comes up, then it fills the list. Share this post Link to post
Rollo62 538 Posted November 27, 2020 6 minutes ago, Lars Fosdal said: Actually, it does work that way. First the window comes up, then it fills the list. Well spotted, delivering hard evidence to a hypothetical discussion From a philosophy standpoint I could say: "Be responsive". On desktop you will get away with non-responsive behaviour, but on mobile your app is very likely KILLED. I leanrned that the hard way Share this post Link to post
Guest Posted November 27, 2020 6 minutes ago, Lars Fosdal said: Actually, it does work that way. First the window comes up, then it fills the list. It looks like that, must be me as stupid person pretend to be a programmer, i didn't know the first rule of writing application. Share this post Link to post
Lars Fosdal 1792 Posted November 27, 2020 Rule #1 was meant to be a joke, but the point is - all that work needs to be done. If you do it before you display the window or after, will matter for the perception of the user. If you are waiting for it to start because it is prepping all the data before showing the first visible hint of running, it is per user perception - slow - or in the worst case if things take long, the user will assume it failed to start. If you first show the window, the user will know it responded and is working. If you show progress information after, the user will know it is still working on something, and people will perceive the "lost time" as less of a nuisance. The total startup time from launch to ready to use, will be the same - but for the user, it will feel faster. Share this post Link to post
Rollo62 538 Posted November 27, 2020 (edited) 16 minutes ago, Kas Ob. said: It looks like that, must be me as stupid person pretend to be a programmer, i didn't know the first rule of writing application. Far from that, don't worry I'm sure you're right, as I said, but for different kind of apps or audience maybe. What you refer to is to safe a second, thats only true for the very professionals, like programmers, designers, 3D animators, you name it. Maybe I am talking about the usual "normal" user, they probably don't care on speed but on clearness of the UI. Startup phase is an important part of the UI IMHO, for example I see many setup programs taking lots of time before showing up. I hate that behaviour, because II always feel unsure if they started, or doing massive trouble, so I have to doublecheck if its running or not. Edited November 27, 2020 by Rollo62 Share this post Link to post
Attila Kovacs 629 Posted November 27, 2020 On 11/26/2020 at 3:29 PM, Lars Fosdal said: Don't do shit before your application has loaded and displayed itself. At least a splash screen would be nice. On 11/26/2020 at 3:29 PM, Lars Fosdal said: and do stuff in threads, allowing basic interaction with the app You don't want to put your db connection into a thread. Nor many other things. 2 hours ago, Rollo62 said: When I press CtrlAltDel It's so 90's. ctrl+shift+esc 1 Share this post Link to post
Rollo62 538 Posted November 27, 2020 29 minutes ago, Attila Kovacs said: It's so 90's. ctrl+shift+esc Oh so 20's: Today, I say "Alexa, kill bill" Next year, I think: "GPT-3, optimize Windows and solve my customer Scott's code issues" 1 Share this post Link to post
Guest Posted November 27, 2020 (edited) I don't know where to start... Thank you all for you comments! @Clément, this is a new project. I have been at it for 3 years 🙂 It will become OpenSource when i have finished the work with the current client, then all can scrutinize. It is a 3-tier system, so during exe startup, no datasets are activated, but a lot of resources are loaded. DevExpress multi-record controls and layouts can be loaded with all datasets active = false (!) so first the user sees the layout and can select tabs and then the user can "load/activate data". It's really very nifty. Data activation and loading are well tuned so it's almost looks like activating memdatasets, even over 4G. Thing is i have made it a "portable install" (because of some client needs) and as such trying to maintain "one exe only" (this is of course one issue in this context). So, to answer @Mahdi Safsafi too, no dll's at all. I have not had the time to check with a profiler yet. I'm sure i will reach lots of conclusions... and i will revisit this thread. 10-4. /Dany Edited November 27, 2020 by Guest Share this post Link to post