VirtualBox

儲存庫 kBuild 的更動 1859


忽略:
時間撮記:
2008-10-13 上午04:52:13 (16 年 以前)
作者:
bird
訊息:

kmk: cache 'struct dep' memory to safe time in free() and xmalloc() during snap_deps().

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/kmk/misc.c

    r1842 r1859  
    709709
    710710
     711#ifdef KMK
     712/* Cache free struct dep to save time in free during snap_deps.
     713   free is esp. slow on darwin for some reason. */
     714static struct dep *free_deps;
     715
     716static struct dep *
     717alloc_dep_int (void)
     718{
     719    struct dep *d = free_deps;
     720    if (d)
     721      free_deps = d->next;
     722    else
     723      d = xmalloc (sizeof (struct dep));
     724    return d;
     725}
     726
     727static void
     728free_dep_int (struct dep *d)
     729{
     730  d->next = free_deps;
     731  free_deps = d;
     732}
     733#endif /* KMK */
     734
     735
    711736/* Allocate a new `struct dep' with all fields initialized to 0.   */
    712737
     
    714739alloc_dep ()
    715740{
     741#ifndef KMK
    716742  struct dep *d = xmalloc (sizeof (struct dep));
     743#else
     744  struct dep *d = alloc_dep_int ();
     745#endif
    717746  memset (d, '\0', sizeof (struct dep));
    718747  return d;
     
    725754free_dep (struct dep *d)
    726755{
     756#ifndef KMK
    727757  free (d);
     758#else
     759  free_dep_int (d);
     760#endif
    728761}
    729762
     
    739772  while (d != 0)
    740773    {
     774#ifndef KMK
    741775      struct dep *c = xmalloc (sizeof (struct dep));
     776#else
     777      struct dep *c = alloc_dep_int ();
     778#endif
    742779      memcpy (c, d, sizeof (struct dep));
    743780
     
    763800      struct dep *df = d;
    764801      d = d->next;
     802#ifndef KMK
    765803      free_dep (df);
     804#else
     805      free_dep_int (df);
     806#endif
    766807    }
    767808}
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette