Just another Perl shrine | |
PerlMonks |
Re^4: Time modulesby Marshall (Canon) |
on Feb 24, 2009 at 21:52 UTC ( [id://746117]=note: print w/replies, xml ) | Need Help?? |
Beth is on it!
I would add that be careful as any kind of user display is a VERY expensive operation - more expensive than even opening a file. I usually put a thin layer that counts N units of work. This is called after every work unit. When N units are reached (or time window, etc), this routine calls the UI. The main point here is that the UI is SLOW. If say you are doing 10,000 things and have a progress bar with 0-100%, there will be a HUGE performance difference between just calling that UI 100 times vs 10,000 times! If your program makes progress very quickly, do a test case just to see how fast the progress can go from 0% to 100% without doing any "real" work. You will be amazed. In this type of case, the CPU power required to calculate the time since last display will be dwarfed by the CPU power required to actually display something. This is true on command line as well as GUI. Some folks think that command line display is fast, but that is not true. In some cases this can be even slower than a GUI display. I hate this Microsoft file copy display. It it just a picture and is a separate process unrelated to the actual work being done. If you have a choice, always display something that is related to the amount of work that has been done, not just a "I am working" message.
In Section
Seekers of Perl Wisdom
|
|