|
|
Author: pmichaud
Date: Mon Dec 31 11:40:33 2007
New Revision: 24355
Modified:
trunk/tools/dev/pbc_to_exe_gen.pl
Log:
[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.
Modified: trunk/tools/dev/pbc_to_exe_gen.pl
==============================================================================
--- trunk/tools/dev/pbc_to_exe_gen.pl (original)
+++ trunk/tools/dev/pbc_to_exe_gen.pl Mon Dec 31 11:40:33 2007
@@ -103,7 +103,7 @@
buffer_size = $P0['longsize'] # sizeof (opcode_t)
.local string bytecode
- bytecode = ''
+ bytecode = ' '
.local int size
size = 0
.local pmc data
@@ -126,23 +126,15 @@
# 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
|
|