Skip to content
  • Yorick Peterse's avatar
    Simplify tracing code to improve performance · e0a458d4
    Yorick Peterse authored
    In commit 347ade20 a new approach to
    tracing objects was introduced, improving performance in the process.
    This implementation used a "busy" counter to terminate tracer threads
    when all work was complete.
    
    While the approach was correct, it was not efficient. When there is
    little work to do, threads would spin for much longer than needed, as
    all threads observing "busy" to be 0 could take a while based on timings
    and bad luck. In various cases this meant tracing would take 20-30
    milliseconds, even though all work was done in less than 5 milliseconds.
    
    In this commit we greatly simplify the tracing approach by just letting
    threads terminate when they run out of work, regardless of the number of
    busy workers. In some rare cases this may result in threads terminating
    prematurely, but for all tests we ran so far this has not proven to be a
    problem. In fact, the current approach drastically cuts down garbage
    collection timings, and makes the tracing code much simpler.
    e0a458d4