Branch: Tag:

2001-02-02

2001-02-02 13:04:46 by Per Hedbor <ph@opera.com>

Made a try with encode_value_canonic in the argcache, but it was slower. Left the code inside #if 0 for future reference.

Rev: server/base_server/roxen.pike:1.625

4:   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.      // ABS and suicide systems contributed freely by Francesco Chemolli - constant cvs_version="$Id: roxen.pike,v 1.624 2001/02/02 12:04:48 noring Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.625 2001/02/02 13:04:46 per Exp $";      // Used when running threaded to find out which thread is the backend thread,   // for debug purposes only.
2384:    //! argument cache. The string returned is your key to retrieve the    //! data later.    { +  array q; + #if 1    array b = values(args), a = sort(indices(args),b);    string data = encode_value(({a,b})); -  + #else +  string data = encode_value_canonic( args ); + #endif +  if( q = cache[ data ] ) +  return q[ CACHE_SKEY ];    -  if( cache[ data ] ) -  return cache[ data ][ CACHE_SKEY ]; -  +     if( sizeof( cache ) >= CACHE_SIZE )    {    array i = indices(cache);
2428:    if(!q) error("Requesting unknown key\n");       mixed data = decode_value(q); + #if 1 +  if( arrayp( data ) )    data = mkmapping( data[0],data[1] ); -  + #endif       cache[ q ] = ({0,0});    cache[ q ][ CACHE_VALUE ] = data;