Branch: Tag:


2014-12-04 19:26:26 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.

2217:    copy_shared_string (dec->decode_string, data->data_str);       if (decoding) { -  push_constant_text ("Error while decoding "); n++; -  push_constant_text ("%O"); +  push_text ("Error while decoding "); n++; +  push_text ("%O");    push_svalue (decoding);    f_sprintf (2); n++; -  push_constant_text (":\n"); n++; +  push_text (":\n"); n++;    }    else { -  push_constant_text ("Decode error: "); n++; +  push_text ("Decode error: "); n++;    }       init_string_builder (&sb, 0);