From 08961bff3bf101db3d9f71b7737ec1b0cac17424 Mon Sep 17 00:00:00 2001 From: pmichaud Date: Mon, 31 Dec 2007 19:40:33 +0000 Subject: [PATCH] [pbc_to_exe]: * On my platform at least (32-bit Ubuntu Gutsy), repeated string concatenations are much faster than pushing to an array and doing a subsequent join. With this patch, "pbc_to_exe perl6.pbc" takes 5.5 seconds on my system instead of 18. * We also eliminate the sprintf "%d" step, since $S0 = $I0 will have the same effect. git-svn-id: https://svn.perl.org/parrot/trunk@24355 d31e2699-5ff4-0310-a27c-f18f2fbe73fe --- tools/dev/pbc_to_exe_gen.pl | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tools/dev/pbc_to_exe_gen.pl b/tools/dev/pbc_to_exe_gen.pl index 0c19eb1b27..03449e7667 100644 --- a/tools/dev/pbc_to_exe_gen.pl +++ b/tools/dev/pbc_to_exe_gen.pl @@ -103,7 +103,7 @@ proper_args: buffer_size = $P0['longsize'] # sizeof (opcode_t) .local string bytecode - bytecode = '' + bytecode = ' ' .local int size size = 0 .local pmc data @@ -126,23 +126,15 @@ proper_args: # convert byte to integer byte = ord byte_string - # convert integer to string - $P0 = new 'ResizablePMCArray' - push $P0, byte - byte_string = sprintf '%%d', $P0 - - # add the string for the byte - push all_bytes, byte_string + $S0 = byte + # add string for the byte + bytecode .= $S0 + bytecode .= ",\n " size += 1 goto loop end_loop: - # format for c file - bytecode = ' ' - $S0 = join ",\n ", all_bytes - bytecode .= $S0 - data['BYTECODE'] = bytecode data['SIZE'] = size -- 2.11.4.GIT