-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstress1.pasm
91 lines (67 loc) · 1.4 KB
/
stress1.pasm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Copyright (C) 2001-2006, Parrot Foundation.
# $Id$
=head1 NAME
examples/benchmarks/stress1.pasm - GC stress-testing
=head1 SYNOPSIS
% time ./parrot examples/benchmarks/stress1.pasm
=head1 DESCRIPTION
Creates 500 arrays with 20000 elements each. Prints out the number of
GC runs made.
=cut
# Our master loop, I20 times
set I20, 10
time N0
new P10, 'ResizableIntegerArray'
mloop:
set I0, 10
new P0, 'ResizablePMCArray'
ol: local_branch P10, buildarray
set P0[I0], P1
dec I0
if I0, ol
set I0, 20
new P2, 'ResizablePMCArray'
ol1: local_branch P10, buildarray
set P2[I0], P1
dec I0
if I0, ol1
set I0, 20
new P3, 'ResizablePMCArray'
ol2: local_branch P10, buildarray
set P3[I0], P1
dec I0
if I0, ol2
time N1
sub N2, N1, N0
set N0, N1
print N2
interpinfo I1, 2
print "\nA total of "
print I1
print " GC runs were made\n"
dec I20
if I20, mloop
end
# Our inner loop, 20000 times
buildarray:
set I1, 20000
new P1, 'ResizablePMCArray'
set P1, I1 # set length => fixed sized array
loop1: new P9, 'Integer'
set P9, I1
set P1[I1], P9
dec I1
if I1, loop1
local_return P10
=head1 SEE ALSO
F<examples/benchmarks/stress.pasm>,
F<examples/benchmarks/stress.pl>,
F<examples/benchmarks/stress1.pl>,
F<examples/benchmarks/stress2.pl>,
F<examples/benchmarks/stress3.pasm>.
=cut
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: