This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: New attribute "infrequent"?


I would not use a simple attribute but an attribute with a number which
contains the frequency the function is used.

For functions which are used a precise number this is the count of usages
(for instance 0, 1, 2, 4) or periodically called functions this is the call
frequency (for instance in calls/minute). So you have an attribute to say:

  - normally this function is never used     frequency(0)              \
  - normally this function is used once	     frequency(1)              | *1
  - normally this function is used twice     frequency(2)              |
  - function is called 6 times per minute    frequency(6)              /
  - function is used once per second	     frequency(60)             - *2
  - function is used 1000 times per second   frequency(60000)          - *3
  - function is used 10^6 times per second   frequency(60000000)       - *4
  - I don't know anything		     -

This is also much more usable for profiling.
I would avoid such fuzzy stuff like infrequent or frequent.
20 programmers and 21 opinions about what this means.

  
*1  heavily optimize for size, use also nasty tricks which slows down code significantly
*2  optimize for size
*3  optimize for speed
*4  heavily optimize for speed, maybe using different code for different CPUs
    (like the icc), inline as much as you can!

-- 
Frank Klemm


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]