tags:

views:

199

answers:

5

hi all

I am writing my own text editor, and I was wondering how can I make it load faster. Notepad.exe witch comes with windows loads almost instantly and it is a small application (on XP is 67.5KB), I know that my app is a MDI project, but it has ~900KB and it loads in 5 seconds. I could write a DLL with all bitmaps and load them from there but I don't thing that this is the solution. Anyone has any ideea?

thanks

+1  A: 

Often, it's the perceived speed that's important rather than the actual speed. If you can get a splash screen up as quickly as possible and continue initializing while that's up, people will see that as faster.

Another trick is to put most of your code into DLLs and run your program on Windows startup with a special invisible mode:

myprog.exe /sneaky

which may convince Windows to leave your DLLs in memory so that, next time your application starts, it's faster.

Or even stay running in memory in invisible mode and, when the user runs myprog.exe themselves, simply make yourself visible.

Yet again, use lazy-loading DLLs for the bulk of your functionality (we've used this one under UNIX) so that it's only loaded when needed. This amortizes the loading process over the total execution time rather than taking a big hit at startup.

Those are some tricks I've heard of, there may be others.

paxdiablo
I consider the "sneaky" mode to be abusive to users, unless you absolutely *know* that they will be using your program. It means you are forcing the user to wait for your program with every boot, whether they will use it or not.
JosephStyons
Yes, it is abusive to users. And it's one of the first things I get rid of for apps I don't run often (not OOo of course, I use that too much). But it's a dog-eat-dog world out there and, if it makes your app seem faster, it's a valid approach.
paxdiablo
+3  A: 

In one of my projects I gained a tremendous decrease in loading time by disabling the autocreation of forms. Only the mainform is created in the DPR, all others are created when needed.

Uwe Raabe
I already have done that :)
Remus Rigo
A: 

Try to omit the code on the start and initializations sections, and see if there's any improvement, then check which section make your application load slower in this case.

and if you testing the startup time with opening text file, try to replace TMEMO (if you are using it) with SynEdit and it will load the text files a lot faster, even from Notepad ;-).

Mohammed Nasman
+1  A: 

All performance problems, can be solved by looking at the code that is executed.

Guessing what is causing the performance problems may have you spinning your wheels for a long time. When you have a performance problem, you need to profile your code. There are various tools for Delphi out there to help you do this.

Some of which are:

These and other options were discussed in this Stack Overflow Question

There are various techniques to speed up code once you have identified what the problem areas are. Since you have identified the area you want to improve, profile the start up of your application.

You may find that your creating things such as forms, resources, or other object that don't need to be created at startup.

Often applications have more than one way they can be started. Since your application is a text editor I suspect you may have a command line where you can specify the file you want to edit. Profiling the different ways you can start your application is key to make sure really know all the impacts of performance improvement.

Robert Love
A: 

I noticed that my project loads E_SKU327.dll and E_DAUDF1.dll about 20 times, those files belong to a shared printer (Epson Stylus), so I removed the TPageSetupDialog from my form, and it loads instantly :)

Problem solved :)

Remus Rigo
I don't have so much free time, only now I have noticed this
Remus Rigo