386BSD 0.1 development
[unix-history] / usr / othersrc / public / ghostscript-2.4.1 / timing.ps
CommitLineData
e19f6432
WJ
1% Copyright (C) 1991 Aladdin Enterprises. All rights reserved.
2% Distributed by Free Software Foundation, Inc.
3%
4% This file is part of Ghostscript.
5%
6% Ghostscript is distributed in the hope that it will be useful, but
7% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
8% to anyone for the consequences of using it or for whether it serves any
9% particular purpose or works at all, unless he says so in writing. Refer
10% to the Ghostscript General Public License for full details.
11%
12% Everyone is granted permission to copy, modify and redistribute
13% Ghostscript, but only under the conditions described in the Ghostscript
14% General Public License. A copy of this license is supposed to have been
15% given to you along with Ghostscript so you can know your rights and
16% responsibilities. It should be in a file named COPYING. Among other
17% things, the copyright notice and this notice must be preserved on all
18% copies.
19
20% timing.ps
21% Time the computational and I/O operations of the Ghostscript interpreter.
22
23% Iterate through a string.
24(
25usertime
26/s 10000 string def
2710 { s { pop } forall } repeat
28usertime exch sub (forall, 100000 string elements\n) print == flush
29)
30 pop
31
32% Iterate through integers.
33usertime
340 1 1 60000 { add } for pop
35usertime exch sub (for, 60000 integers\n) print == flush
36
37% Read short identifiers from a file.
38/a 0 def
39/rpt
40 { cleartomark exch 1 sub exch 1 index 0 ne
41 { dup currentfile exch setfileposition } if
42 } bind def
43(
44usertime
45500 currentfile fileposition
46
47mark
48a a a a a a a a a a a a a a a a a a a a a a a a a
49a a a a a a a a a a a a a a a a a a a a a a a a a
50a a a a a a a a a a a a a a a a a a a a a a a a a
51a a a a a a a a a a a a a a a a a a a a a a a a a
52
53a a a a a a a a a a a a a a a a a a a a a a a a a
54a a a a a a a a a a a a a a a a a a a a a a a a a
55a a a a a a a a a a a a a a a a a a a a a a a a a
56a a a a a a a a a a a a a a a a a a a a a a a a a
57rpt
58pop pop
59usertime exch sub (read 100000 1-char names\n) print == flush
60)
61 pop
62
63% Read short numbers from a file.
64(
65usertime
66500 currentfile fileposition
67
68mark
690 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
700 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
710 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
730 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
750 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
77rpt
78pop pop
79usertime exch sub (read 100000 1-digit numbers\n) print == flush
80)
81 pop
82
83% Read long names from a file.
84(
85/tenletters 0 def
86usertime
87500 currentfile fileposition
88
89mark
90tenletters tenletters tenletters tenletters tenletters
91tenletters tenletters tenletters tenletters tenletters
92tenletters tenletters tenletters tenletters tenletters
93tenletters tenletters tenletters tenletters tenletters
94
95tenletters tenletters tenletters tenletters tenletters
96tenletters tenletters tenletters tenletters tenletters
97tenletters tenletters tenletters tenletters tenletters
98tenletters tenletters tenletters tenletters tenletters
99rpt
100pop pop
101usertime exch sub (read 20000 10-char names\n) print == flush
102)
103 pop
104
105% Read long numbers from a file.
106(
107usertime
108500 currentfile fileposition
109
110mark
111123.45 123.45 123.45 123.45 123.45
112123.45 123.45 123.45 123.45 123.45
113123.45 123.45 123.45 123.45 123.45
114123.45 123.45 123.45 123.45 123.45
115
116123.45 123.45 123.45 123.45 123.45
117123.45 123.45 123.45 123.45 123.45
118123.45 123.45 123.45 123.45 123.45
119123.45 123.45 123.45 123.45 123.45
120rpt
121pop pop
122usertime exch sub (read 20000 6-digit numbers\n) print == flush
123)
124 pop
125
126% Render text at 300 dpi.
127/onelinedevice
128 { [ 300 72 div 0 0 300 72 div neg 0 60 ] 2550 100 <ff 00>
129 makeimagedevice setdevice
130 } def
131/s50 (The rain in Spain stays mainly in the plain. -Shaw) def
132(
133gsave
134onelinedevice
135/Times-Roman findfont 10 scalefont setfont
1360 8 moveto s50 show % preload the cache
137usertime
138600 { 0 8 moveto s50 show } repeat
139usertime exch sub (display 30000 10-point characters at 300 dpi\n) print == flush
140grestore
141)
142 pop
143
144% Process an entire page of text at 300 dpi.
145(
146(_temp_.ps) (w) file
147600
148 { dup (0 8 moveto \() writestring
149 dup s50 writestring
150 dup (\) show\n) writestring
151 } repeat
152closefile
153gsave
154onelinedevice
155/Times-Roman findfont 10 scalefont setfont
1560 8 moveto s50 show % preload the cache
157(_temp_.ps) (r) file
158usertime
159exch cvx exec
160usertime exch sub (display 30000 10-point characters (from a file) at 300 dpi\n) print == flush
161grestore
162(_temp_.ps) deletefile
163)
164 pop
165
166quit