Branch: Tag:


2014-05-22 16:49:17 by Per Hedbor <>

Binary size: push_constant_text -> push_text when not time-critical.

Especially in error handling, and code that does a lot of other string
operations anyway the speed gain is not wort the 100+ bytes code size
of each instance of push_constant_text

This saves about 20K of code size (main pike binary), while not really
changing the speed much.

push_constant_text that seemed to be in at least pseudo-time-critical
code was kept as they were.

On a related note, push_constant_text(":") four times in a row creates
four different string variables, for obvious reasons.

Some of the remaining push_constant_text really should have a
module/file local string variable, even though that is more bothersome
to create.

It might be nice to have this in .cmod files automatically.

1072: Inside #if defined(__NT__)
   get_all_args("get_dir",args,".%T",&str);       if(!str) { -  push_constant_text("."); +  push_text(".");    str = Pike_sp[-1].u.string;    args++;    }
1361: Inside #if defined(__amigaos4__)
  #if defined(__amigaos4__)    push_empty_string();   #else -  push_constant_text("."); +  push_text(".");   #endif    str = Pike_sp[-1].u.string;    args++;
1584: Inside #if defined(HAVE_EXECVE)
      NEW_MAPPING_LOOP(en->data) {    push_string(k->ind.u.string); -  push_constant_text("="); +  push_text("=");    push_string(k->val.u.string);    f_add(3);    env[i++]=sp[-1].u.string->str;
1879:    if(s)    push_text(s);    else { -  push_constant_text("Error "); +  push_text("Error ");    push_int(err);    f_add(2);    }