Created
June 23, 2011 15:03
-
-
Save anonymous/1042698 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sub 'main' | |
.local int N, i | |
N = 20000 | |
.local pmc target, from1, from2 | |
target = new ['ResizablePMCArray'] | |
# array for unshifting | |
from1 = new ['ResizablePMCArray'] | |
$P0 = box 'one' | |
push from1, $P0 | |
$P0 = box 'two' | |
push from1, $P0 | |
$P0 = box 'three' | |
push from1, $P0 | |
$P0 = box 'four' | |
push from1, $P0 | |
$N0 = time | |
i = 0 | |
loop1: | |
unless i < N goto done1 | |
splice target, from1, 0, 0 | |
inc i | |
goto loop1 | |
done1: | |
$N1 = time | |
i = 0 | |
loop2: | |
unless i < N goto done2 | |
splice target, from1, 0, 8 | |
inc i | |
goto loop2 | |
done2: | |
$N2 = time | |
$N3 = $N1 - $N0 | |
$N4 = $N2 - $N1 | |
print N | |
print " unshifts=" | |
print $N3 | |
print ", shifts=" | |
say $N4 | |
.end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment