Commit | Line | Data |
---|---|---|
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 | ( | |
25 | usertime | |
26 | /s 10000 string def | |
27 | 10 { s { pop } forall } repeat | |
28 | usertime exch sub (forall, 100000 string elements\n) print == flush | |
29 | ) | |
30 | pop | |
31 | ||
32 | % Iterate through integers. | |
33 | usertime | |
34 | 0 1 1 60000 { add } for pop | |
35 | usertime 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 | ( | |
44 | usertime | |
45 | 500 currentfile fileposition | |
46 | ||
47 | mark | |
48 | a a a a a a a a a a a a a a a a a a a a a a a a a | |
49 | a a a a a a a a a a a a a a a a a a a a a a a a a | |
50 | a a a a a a a a a a a a a a a a a a a a a a a a a | |
51 | a 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 | ||
53 | a a a a a a a a a a a a a a a a a a a a a a a a a | |
54 | a a a a a a a a a a a a a a a a a a a a a a a a a | |
55 | a a a a a a a a a a a a a a a a a a a a a a a a a | |
56 | a a a a a a a a a a a a a a a a a a a a a a a a a | |
57 | rpt | |
58 | pop pop | |
59 | usertime exch sub (read 100000 1-char names\n) print == flush | |
60 | ) | |
61 | pop | |
62 | ||
63 | % Read short numbers from a file. | |
64 | ( | |
65 | usertime | |
66 | 500 currentfile fileposition | |
67 | ||
68 | mark | |
69 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
70 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
71 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
72 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
73 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
74 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
75 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
76 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | |
77 | rpt | |
78 | pop pop | |
79 | usertime 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 | |
86 | usertime | |
87 | 500 currentfile fileposition | |
88 | ||
89 | mark | |
90 | tenletters tenletters tenletters tenletters tenletters | |
91 | tenletters tenletters tenletters tenletters tenletters | |
92 | tenletters tenletters tenletters tenletters tenletters | |
93 | tenletters tenletters tenletters tenletters tenletters | |
94 | ||
95 | tenletters tenletters tenletters tenletters tenletters | |
96 | tenletters tenletters tenletters tenletters tenletters | |
97 | tenletters tenletters tenletters tenletters tenletters | |
98 | tenletters tenletters tenletters tenletters tenletters | |
99 | rpt | |
100 | pop pop | |
101 | usertime exch sub (read 20000 10-char names\n) print == flush | |
102 | ) | |
103 | pop | |
104 | ||
105 | % Read long numbers from a file. | |
106 | ( | |
107 | usertime | |
108 | 500 currentfile fileposition | |
109 | ||
110 | mark | |
111 | 123.45 123.45 123.45 123.45 123.45 | |
112 | 123.45 123.45 123.45 123.45 123.45 | |
113 | 123.45 123.45 123.45 123.45 123.45 | |
114 | 123.45 123.45 123.45 123.45 123.45 | |
115 | ||
116 | 123.45 123.45 123.45 123.45 123.45 | |
117 | 123.45 123.45 123.45 123.45 123.45 | |
118 | 123.45 123.45 123.45 123.45 123.45 | |
119 | 123.45 123.45 123.45 123.45 123.45 | |
120 | rpt | |
121 | pop pop | |
122 | usertime 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 | ( | |
133 | gsave | |
134 | onelinedevice | |
135 | /Times-Roman findfont 10 scalefont setfont | |
136 | 0 8 moveto s50 show % preload the cache | |
137 | usertime | |
138 | 600 { 0 8 moveto s50 show } repeat | |
139 | usertime exch sub (display 30000 10-point characters at 300 dpi\n) print == flush | |
140 | grestore | |
141 | ) | |
142 | pop | |
143 | ||
144 | % Process an entire page of text at 300 dpi. | |
145 | ( | |
146 | (_temp_.ps) (w) file | |
147 | 600 | |
148 | { dup (0 8 moveto \() writestring | |
149 | dup s50 writestring | |
150 | dup (\) show\n) writestring | |
151 | } repeat | |
152 | closefile | |
153 | gsave | |
154 | onelinedevice | |
155 | /Times-Roman findfont 10 scalefont setfont | |
156 | 0 8 moveto s50 show % preload the cache | |
157 | (_temp_.ps) (r) file | |
158 | usertime | |
159 | exch cvx exec | |
160 | usertime exch sub (display 30000 10-point characters (from a file) at 300 dpi\n) print == flush | |
161 | grestore | |
162 | (_temp_.ps) deletefile | |
163 | ) | |
164 | pop | |
165 | ||
166 | quit |