Re: slow startup on windows

Jeroen van der Zijp <[email protected]> Sun, 27 Oct 2024 23:36:12 -0500
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization FOX Toolkit
Message-ID <[email protected]>
On Sun, 27 Oct 2024 15:50:32 -0400
John Selverian <[email protected]> wrote:

> In my case I’ll just over estimate by 100 then erase the unused ones when I know the exact number. I’ll try it out tomorrow and let you know the speedup

I'm curious what the "doubling" algorithm does, too.

To micro-benchmark, please try the new FXPerformance tick-counter 
based bench-marking support.

How it works:

  1) make sure you pass -DPERFORMANCE_LOGGING=1 on compile line,
     or set it "by hand" in one of your header files.

  2) Make a global variable:

       PERFORMANCE_RECORDER(my_routine);

  3) In your routine:

       PERFORMANCE_COUNTER(my_routine);

Whenever control enters scope containing PERFORMANCE_COUNTER, it logs
the processor tick count.  Likewise, when it leaves, it marks the
tick count again, and tallies the difference using PERFORMANCE_RECORDER.

The tick counter is a register inside the CPU which increments every
clock cycle.  So, its very accurate measure of figuring how fast some
code fragment performs.

At the end of your program, PERFORMANCE_RECORDER's destructor will run,
which will print how long it took averagely, the maximum, minimum, and
total number of times it was called.

W/o the PERFORMANCE_LOGGING preprocessor variable, the macros compile
to nothing.

Needless to say, adding the measurement code slightly slows down the code
as the bookkeeping adds a minor overhead.  So the total is not entirely
cycle-accurate [plus, transitional effects like caching and so in will
never quite get you the exact same cycles even if the overhead were 0].  

Nevertheless, if you're doing something that improves your code in even a 
minor way, you'll see it quickly.

I have used these macros for quite a while; the tick-counter really can
help if you absolutely need to trick out and scrape the bottom of the
barrel of performance.  

For example, rearranging some heavy-duty floating point code in a higher-order 
numerical integration routine; I can see the effect of re-arranging the fp code 
such that the second AVX pipeline can get fully exercised; almost 2x boost was 
possible on my CPU with just a bit of shuffling bits of code.


   Hope this helps,


            -- JVZ



_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users