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]
Other format: [Raw text]

Re: gcc compile-time performance



Here's some more relatively low hanging fruit to pick.  bitmap_find_bit is 
probably the most-called function in the compiler (ok, it is inlined, but 
it is still effectively called).  This cuts the execution time of the 
function by about 45% (according to gprof).  It simply notes that if head->
current is the element we want, we don't have to go and do a lot of 
grunging to reposition the current element to itself!

Still need to do the bootstrap test, but it looks ok to me so far.

R.



*** bitmap.c    31 Oct 2001 03:01:15 -0000      1.33
--- bitmap.c    20 May 2002 13:32:31 -0000
*************** bitmap_find_bit (head, bit)
*** 300,307 ****
    bitmap_element *element;
    unsigned HOST_WIDE_INT indx = bit / BITMAP_ELEMENT_ALL_BITS;
  
!   if (head->current == 0)
!     return 0;
  
    if (head->indx > indx)
      for (element = head->current;
--- 300,308 ----
    bitmap_element *element;
    unsigned HOST_WIDE_INT indx = bit / BITMAP_ELEMENT_ALL_BITS;
  
!   if (head->current == 0
!       || head->indx == indx)
!     return head->current;
  
    if (head->indx > indx)
      for (element = head->current;



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