Branch: Tag:

2013-05-25

2013-05-25 17:29:35 by Per Hedbor <ph@opera.com>

Micro-optimizations for the http_time function

2814:   {    if (zonename=="") return 0;    +  Calendar.Rule.Timezone zone = Calendar.Timezone[zonename]; +  +  if( !zone ) +  {    if (zonename[0]=='"') sscanf(zonename,"\"%s\"",zonename);    sscanf(zonename,"%*[ \t]%s",zonename);   
2825:    if (origin->rules->abbr2zone[zonename])    zonename=origin->rules->abbr2zone[zonename];    -  Calendar.Rule.Timezone zone=Calendar.Timezone[zonename]; +  zone=Calendar.Timezone[zonename]; +     if (!zone)    {    if (sscanf(zonename,"%[^+-]%s",string a,string b)==2 && a!="" && b!="")
2851:    }    return 0;    } -  else +  }    return dwim_tod(origin->set_timezone(zone),whut,@args);   }   
3053:    return 0; // need "am" or "pm"    }    } -  +     if (m->z) // zone    low = dwim_zone(low,m->z,g,h,mi,s);    else if (g)
3274:   {    TimeofDay t;    -  string date1 = "%D %M %Y"; // 2+1+3+1+4=11 -  string date2 = "%D-%M-%y"; // 2+1+3+1+2=9 -  string date3 = "%M %*[ ]%D"; // 2+1+2=5 -  string time = "%h:%m:%s"; // 2+1+2+1+2=8 +  constant date1 = "%D %M %Y"; // 2+1+3+1+4=11 +  constant date2 = "%D-%M-%y"; // 2+1+3+1+2=9 +  constant date3 = "%M %*[ ]%D"; // 2+1+2=5 +  constant time = "%h:%m:%s"; // 2+1+2+1+2=8       // 3+2+ 11 +1+ 8 +4 = 29 -  string rfc1123_date = "%e, "+date1+" "+time+" %z"; +  constant rfc1123_date = "%e, "+date1+" "+time+" %z";       // 6+2+ 9 +1+ 8 +4 = 33 -  string rfc850_date = "%e, "+date2+" "+time+" %z"; +  constant rfc850_date = "%e, "+date2+" "+time+" %z";       // 3+1+ 5 +1+ 8 +1+4 = 23 -  string asctime_date = "%e "+date3+" "+time+" %Y"; +  constant asctime_date = "%e "+date3+" "+time+" %Y";       if( sizeof(what)<23 ) return 0;