|
Posted by Jeckyl on 01/21/07 02:09
In case you want to know why the code I put forward is faster, the reason is
that one of the main factors in AS speed is the number of opcodes it
compiles to (as there is a similar large amount of overhead for each
opcode). If you look at the compiled code for the two methods of padding.
you'll see that the hatter code requires more opcodes .. even if the padding
with zero is not required. And, of course, my code works with all the
possible rgb colors that getPixel returns; hatters fails in many cases.
Hatter compiled code:
push 'color_pick', 16, 1, 'clr'
getVariable
push 'toString'
callMethod
setVariable
push 'color_pick'
getVariable
push 'length'
getMember
push 6
lessThan
not
branchIfTrue label2
push 'color_pick', '0', 'color_pick'
getVariable
add
setVariable
label2:
Jeckyl compiled code:
push 'color_pick', -6, 1, '000000', 16, 1, 'clr'
getVariable
push 'toString'
callMethod
add
push 'substr'
callMethod
setVariable
--
Jeckyl
Navigation:
[Reply to this message]
|