Skip to content

Instantly share code, notes, and snippets.

Created June 23, 2011 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1042698 to your computer and use it in GitHub Desktop.
Save anonymous/1042698 to your computer and use it in GitHub Desktop.
.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