Made activate_latent_in() iterations much more efficient
authorDima Kogan <dima@secretsauce.net>
Wed, 9 Jul 2014 08:09:33 +0000 (01:09 -0700)
committerChanho Park <chanho61.park@samsung.com>
Fri, 22 Aug 2014 11:38:26 +0000 (20:38 +0900)
commit070dc5826c9015cf8d8bfa04c429f419fd9d08ff
tree39c356ad730607b5684edf394d35b23a650349f0
parentac6502b964595e8eb8d5268ed9d79824cacaba91
Made activate_latent_in() iterations much more efficient

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.
library.c
library.h
proc.c