Skip to content
  • Simon Peyton Jones's avatar
    Fix quadratic behaviour in tidyOccName · c89bd681
    Simon Peyton Jones authored
    In the test program from comment:3 of Trac #10370, it turned out
    that 25% of all compile time was going in OccName.tidyOccName!
    
    It was all becuase the algorithm for finding an unused OccName
    had a quadratic case.
    
    This patch fixes it.  THe effect is pretty big:
    
    Before:
    	total time  =       34.30 secs   (34295 ticks @ 1000 us, 1 processor)
    	total alloc = 15,496,011,168 bytes  (excludes profiling overheads)
    
    After
    	total time  =       25.41 secs   (25415 ticks @ 1000 us, 1 processor)
    	total alloc = 11,812,744,816 bytes  (excludes profiling overheads)
    c89bd681