benchmark/lib/timers-ctx.js
function insert(item, msecs) {
  item._idleStart = Timer.now();
  item._idleTimeout = msecs;

  if (msecs < 0) return;

  var list;

  if (lists[msecs]) {
    list = lists[msecs];
  } else {
    list = new Timer();
    list.start(msecs, 0);

    L.init(list);

    lists[msecs] = list;
    list.msecs = msecs;
    list[kOnTimeout] = listOnTimeout;
  }

  L.append(list, item);
  assert(!L.isEmpty(list)); // list is not empty
}
function insert(item, msecs) {
  item._idleStart = Timer.now();
  item._idleTimeout = msecs;

  if (msecs < 0) return;

  var list;

  if (lists[msecs]) {
    list = lists[msecs];
  } else {
    list = new Timer();
    list.start(msecs, 0);

    L.init(list);

    lists[msecs] = list;
    list.msecs = msecs;
    list[kOnTimeout] = listOnTimeout;
  }

  L.append(list, item);
  assert(!L.isEmpty(list)); // list is not empty
}
function insert ( item , msecs ) { item . _idleStart = Timer . now ( ) ; item . _idleTimeout = msecs ; if ( msecs < 0 ) return ; var list ; if ( lists [ msecs ] ) { list = lists [ msecs ] ; } else { list = new Timer ( ) ; list . start ( msecs , 0 ) ; L . init ( list ) ; lists [ msecs ] = list ; list . msecs = msecs ; list [ kOnTimeout ] = listOnTimeout ; } L . append ( list , item ) ; assert ( ! L . isEmpty ( list ) ) ; // list is not empty }
the main function - creates lists on demand and the watchers associated with them.
the main function - creates lists on demand and the watchers associated with them .