Ticket #717: fake_string_newline_optimization.patch
File fake_string_newline_optimization.patch, 0.8 KB (added by Util, 13 years ago) |
---|
-
src/io/api.c
319 319 if (PMC_IS_NULL(pmc)) 320 320 return -1; 321 321 322 /* There is a GC issue with using the fake STRING. 323 * However, it would be a performance drain to use Parrot_str_new for each call. 324 * For now, optimize for "\n", which will remove the GC issue during the execution 325 * of `say 'constant'`. 326 */ 327 if (length == 1 && ((const char *)buffer)[0] == '\n') { 328 result = Parrot_io_putps(interp, pmc, CONST_STRING(interp, "\n")); 329 return result; 330 } 331 322 332 fake.strstart = (char *) PARROT_const_cast(void *, buffer); 323 333 fake.strlen = fake.bufused = length; 324 334 fake.charset = Parrot_default_charset_ptr;