Ignore:
Timestamp:
Nov 22, 2002, 3:20:01 PM (23 years ago)
Author:
darin
Message:
  • prepare to reimplement KJS::List; move to its own file, add statistics
  • kjs/function_object.cpp: (FunctionProtoFuncImp::call): Use new copyTail() function rather than copy() and removeFirst().
  • kjs/identifier.cpp: Add statistics, off by default.
  • kjs/property_map.cpp: Add statistics, off by default.
  • kjs/list.cpp: Added. Moved code here. To be rewritten.
  • kjs/list.h: Added. Moved interface here. To be rewritten.
  • kjs/types.cpp: Removed.
  • kjs/types.h: Now just an empty header that includes other headers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/identifier.cpp

    r2800 r2834  
    2222#include "identifier.h"
    2323
     24#define DUMP_STATISTICS 0
     25
    2426namespace KJS {
     27
     28#if DUMP_STATISTICS
     29
     30static int numProbes;
     31static int numCollisions;
     32
     33struct IdentifierStatisticsExitLogger { ~IdentifierStatisticsExitLogger(); };
     34
     35static IdentifierStatisticsExitLogger logger;
     36
     37IdentifierStatisticsExitLogger::~IdentifierStatisticsExitLogger()
     38{
     39    printf("\nKJS::Identifier statistics\n\n");
     40    printf("%d probes\n", numProbes);
     41    printf("%d collisions (%.1f%%)\n", numCollisions, 100.0 * numCollisions / numProbes);
     42}
     43
     44#endif
    2545
    2646Identifier Identifier::null;
     
    93113   
    94114    int i = hash & _tableSizeMask;
     115#if DUMP_STATISTICS
     116    ++numProbes;
     117    numCollisions += _table[i] && !equal(_table[i], c);
     118#endif
    95119    while (UString::Rep *key = _table[i]) {
    96120        if (equal(key, c))
     
    130154   
    131155    int i = hash & _tableSizeMask;
     156#if DUMP_STATISTICS
     157    ++numProbes;
     158    numCollisions += _table[i] && !equal(_table[i], s, length);
     159#endif
    132160    while (UString::Rep *key = _table[i]) {
    133161        if (equal(key, s, length))
     
    169197   
    170198    int i = hash & _tableSizeMask;
     199#if DUMP_STATISTICS
     200    ++numProbes;
     201    numCollisions += _table[i] && !equal(_table[i], r);
     202#endif
    171203    while (UString::Rep *key = _table[i]) {
    172204        if (equal(key, r))
     
    191223   
    192224    int i = hash & _tableSizeMask;
     225#if DUMP_STATISTICS
     226    ++numProbes;
     227    numCollisions += _table[i] != 0;
     228#endif
    193229    while (_table[i])
    194230        i = (i + 1) & _tableSizeMask;
     
    204240   
    205241    int i = hash & _tableSizeMask;
     242#if DUMP_STATISTICS
     243    ++numProbes;
     244    numCollisions += _table[i] && equal(_table[i], r);
     245#endif
    206246    while ((key = _table[i])) {
    207247        if (equal(key, r))
Note: See TracChangeset for help on using the changeset viewer.