Branch: Tag:

2004-05-18

2004-05-18 01:06:46 by Martin Nilsson <mani@lysator.liu.se>

12% optimization of has_prefix/has_suffix. These functions was the major callers of get_all_args by a factor 100 over other functions, which prompted for an optimization of get_all args. Solved by not calling it at all instead. Waste space, save cycles.

Rev: src/builtin_functions.c:1.557

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin_functions.c,v 1.556 2004/05/14 18:18:42 nilsson Exp $ + || $Id: builtin_functions.c,v 1.557 2004/05/18 01:06:46 nilsson Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.556 2004/05/14 18:18:42 nilsson Exp $"); + RCSID("$Id: builtin_functions.c,v 1.557 2004/05/18 01:06:46 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
922:   {    struct pike_string *a, *b;    -  get_all_args("has_prefix", args, "%W%W", &a, &b); +  if(args<2) +  SIMPLE_TOO_FEW_ARGS_ERROR("has_prefix", 2); +  if(Pike_sp[-args].type!=T_STRING) +  SIMPLE_ARG_TYPE_ERROR("has_prefix", 1, "string"); +  if(Pike_sp[1-args].type!=T_STRING) +  SIMPLE_ARG_TYPE_ERROR("has_prefix", 2, "string");    -  +  a = Pike_sp[-args].u.string; +  b = Pike_sp[1-args].u.string; +     /* First handle some common special cases. */    if ((b->len > a->len) || (b->size_shift > a->size_shift)) {    pop_n_elems(args);
983:   {    struct pike_string *a, *b;    -  get_all_args("has_suffix", args, "%W%W", &a, &b); +  if(args<2) +  SIMPLE_TOO_FEW_ARGS_ERROR("has_suffix", 2); +  if(Pike_sp[-args].type!=T_STRING) +  SIMPLE_ARG_TYPE_ERROR("has_suffix", 1, "string"); +  if(Pike_sp[1-args].type!=T_STRING) +  SIMPLE_ARG_TYPE_ERROR("has_suffix", 2, "string");    -  +  a = Pike_sp[-args].u.string; +  b = Pike_sp[1-args].u.string; +     /* First handle some common special cases. */    if ((b->len > a->len) || (b->size_shift > a->size_shift)) {    pop_n_elems(args);