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 reply to Re^4: Time modules by Marshall
in thread Time modules by mikejones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.