Skip to content
  • Dima Kogan's avatar
    Made activate_latent_in() iterations much more efficient · c3be3770
    Dima Kogan authored
    Previously activate_latent_in() iterations looked like
    
    for(export names in lib1) // hash table iteration
    {
      for(symbol names in lib2) // list iteration
      {
        if(names equal && libsym->latent)
        {
          proc_activate_latent_symbol(proc, libsym)
        }
      }
    }
    
    This is inefficient both due to the double iteration but also since iterating
    over a hash table in slow (have to look through all cells, even empty ones).
    This patch turns this logic into
    
    for(symbol names in lib2) // list iteration
    {
      if(name in lib1 export names && libsym->latent) // hash table lookup
      {
        proc_activate_latent_symbol(proc, libsym)
      }
    }
    
    So there's no more double iteration, and the hash iteration was turned into a
    hash lookup. Much better.
    c3be3770