lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


We translated to Lua the scripts from the "Experiments with Scripting and 
User-Interface Languages", by Brian W. Kernighan & Christopher J. Van Wyk 
(see at http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html). Here are
the timings for Lua (new version), Lua 3.2, and Perl (version 5.004_04 
built for i386-linux). (We will soon put the scprits in the site.)


		lua	lua3.2	perl

sumloop 100k	0.07	0.14	0.16
sumloop 1000k	0.54	1.23	1.36

array1 10k	0.09	0.11	0.11   (perl = 0.64 with associative arrays)
array1 100k	0.76	0.95	0.94   (perl = 6.25 with associative arrays)
array1 1000k	6.94	8.58	9.23

string 100k	0.13	0.44	0.10
string 1000k	1.40	4.54	1.21

ack 3 6		0.29	0.38	1.73
ack 3 7		1.18	1.52	7.18
ack 3 8		4.76	(*)	30.7    (* = stack overflow)

assoc 10k	0.40	0.44	0.29
assoc 100k	4.18	4.55	2.82

cat (bib)	0.58	0.84	0.74
cat1 (bib)	0.16	0.25			(read whole file)
cat (M)		2.68	4.56	1.81
cat1 (M)	0.22	0.38			(read whole file)

wc (bib)	2.36	2.64	4.54
wc1 (bib)	3.49	3.66			(read whole file)
wc (M)		5.07	6.15	7.37
wc1 (M)		4.70	4.91			(read whole file)

tail (bib)	0.72	1.06	0.98
tail (M)	3.88	5.63	3.31

sum1 100k	1.39	1.75	2.50
sum1 rn100	1.39	1.77	2.55
sum1 1000k	13.7	17.4	24.8


obs: the tests were made in a Linux 2.0.36, Pentium 333, with 128Mbytes.
obs: time = user+system
obs: k=1000 (and not 1024)
obs: `bib' is the King James Bible, and `M' is a huge program (in Lua):
  31102  851820 4460056 bible
 270877  646309 6719734 M

-- Roberto