% Copyright (C) 1991 Aladdin Enterprises. All rights reserved.
% Distributed by Free Software Foundation, Inc.
% This file is part of Ghostscript.
% Ghostscript is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
% to anyone for the consequences of using it or for whether it serves any
% particular purpose or works at all, unless he says so in writing. Refer
% to the Ghostscript General Public License for full details.
% Everyone is granted permission to copy, modify and redistribute
% Ghostscript, but only under the conditions described in the Ghostscript
% General Public License. A copy of this license is supposed to have been
% given to you along with Ghostscript so you can know your rights and
% responsibilities. It should be in a file named COPYING. Among other
% things, the copyright notice and this notice must be preserved on all
% Time the computational and I/O operations of the Ghostscript interpreter.
% Iterate through a string.
10 { s { pop } forall } repeat
usertime exch sub (forall, 100000 string elements\n) print == flush
% Iterate through integers.
0 1 1 60000 { add } for pop
usertime exch sub (for, 60000 integers\n) print == flush
% Read short identifiers from a file.
{ cleartomark exch 1 sub exch 1 index 0 ne
{ dup currentfile exch setfileposition } if
500 currentfile fileposition
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
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
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
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
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
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
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
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
usertime exch sub (read 100000 1-char names\n) print == flush
% Read short numbers from a file.
500 currentfile fileposition
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
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
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
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
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
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
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
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
usertime exch sub (read 100000 1-digit numbers\n) print == flush
% Read long names from a file.
500 currentfile fileposition
tenletters tenletters tenletters tenletters tenletters
tenletters tenletters tenletters tenletters tenletters
tenletters tenletters tenletters tenletters tenletters
tenletters tenletters tenletters tenletters tenletters
tenletters tenletters tenletters tenletters tenletters
tenletters tenletters tenletters tenletters tenletters
tenletters tenletters tenletters tenletters tenletters
tenletters tenletters tenletters tenletters tenletters
usertime exch sub (read 20000 10-char names\n) print == flush
% Read long numbers from a file.
500 currentfile fileposition
123.45 123.45 123.45 123.45 123.45
123.45 123.45 123.45 123.45 123.45
123.45 123.45 123.45 123.45 123.45
123.45 123.45 123.45 123.45 123.45
123.45 123.45 123.45 123.45 123.45
123.45 123.45 123.45 123.45 123.45
123.45 123.45 123.45 123.45 123.45
123.45 123.45 123.45 123.45 123.45
usertime exch sub (read 20000 6-digit numbers\n) print == flush
% Render text at 300 dpi.
{ [ 300 72 div 0 0 300 72 div neg 0 60 ] 2550 100 <ff 00>
makeimagedevice setdevice
/s50 (The rain in Spain stays mainly in the plain. -Shaw) def
/Times-Roman findfont 10 scalefont setfont
0 8 moveto s50 show % preload the cache
600 { 0 8 moveto s50 show } repeat
usertime exch sub (display 30000 10-point characters at 300 dpi\n) print == flush
% Process an entire page of text at 300 dpi.
{ dup (0 8 moveto \() writestring
dup (\) show\n) writestring
/Times-Roman findfont 10 scalefont setfont
0 8 moveto s50 show % preload the cache
usertime exch sub (display 30000 10-point characters (from a file) at 300 dpi\n) print == flush