[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: performance comparison
- From: David Jeske <jeske@...>
- Date: Tue, 19 May 1998 18:55:23 -0700
This performance comparison was done by a friend of mine. It's a standard
set of tests they ran on script languages at his former employer.
I just wanted to note that Lua is very fast on most operations, but it got
killed on complex FP, and file access. I don't know if Lua or Perl were
both using doubles or singles or what.
----- Forwarded message from Chris Trimble <chris@pdi.com> -----
Date: Tue, 19 May 1998 09:54:36 -0700
From: Chris Trimble <chris@pdi.com>
To: David Jeske <jeske@home.chat.net>
Subject: Re: script performance comparison
On Fri, May 15, 1998 at 02:26:47PM -0700, David Jeske wrote:
> Hey Chris,
>
> do you have the results of that performance comparison of script languages
> around? I can't find it.
Here you go... this is just Lua, Python and Perl. I do have this coded
up in Java, Smalltalk, TCL and C++, but haven't run those in a while.
BTW -- I got my computer home. Limited tests with the FireGL have proven
that it's not that amazing, but it was only with the OpenGL screensavers.
A friend of mine is going to hook me up with 3DS Max, so I'll check that
out. I'll probably head over to Fry's and pick up some games. Otherwise,
the computer kicks ass!
- Chris
Iris Audio Processor: version A2 revision 1.1.0
1 150 MHZ IP22 Processor
FPU: MIPS R4010 Floating Point Chip Revision: 0.0
CPU: MIPS R4400 Processor Chip Revision: 5.0
On-board serial ports: 2
On-board bi-directional parallel port
Data cache size: 16 Kbytes
Instruction cache size: 16 Kbytes
Secondary unified instruction/data cache size: 1 Mbyte
Main memory size: 256 Mbytes
EISA bus: adapter 0
Integral Ethernet: ec0, version 1
Integral SCSI controller 1: Version WD33C93B, revision D
Disk drive: unit 3 on SCSI controller 1
Integral SCSI controller 0: Version WD33C93B, revision D
Disk drive: unit 1 on SCSI controller 0
Graphics board: GR3-XZ
Mon Dec 15 10:52:37 1997Mon Dec 15 10:52:44 1997Index test done (6 sec)
Mon Dec 15 10:52:44 1997Mon Dec 15 10:53:15 1997System test done (31 sec)
Mon Dec 15 10:53:15 1997Mon Dec 15 10:53:25 1997Basic FP test done (10 sec)
Mon Dec 15 10:53:25 1997Mon Dec 15 10:54:09 1997Complex FP test done (44 sec)
Mon Dec 15 10:54:09 1997Mon Dec 15 10:54:53 1997File access test done (54 sec)
Mon Dec 15 10:54:53 1997Mon Dec 15 10:55:12 1997Nested test done (19 sec)
real 2m35.394s
user 1m50.004s
sys 0m29.777s
chris@laverne python > time python all_test
Python performance test -- Python 1.5
Performing 300000 index accesses in 5 seconds
Performing 1000 system calls in 15 seconds
Performing 1000000 basic arithmetic functions in 35 seconds
Performing 2000000 complex arithmetic functions in 199 seconds
Performing 2000 local file accesses in 33 seconds
Performing 20 nested loops in 46 seconds
Overall test executed in 333 seconds
real 5m36.663s
user 5m9.777s
sys 0m15.621s
Perl performance test -- PERL 5.004
Performing 300000 index operations in 6 seconds
Performing 1000 syscall operations in 25 seconds
Performing 1000000 basic arith operations in 16 seconds
Performing 2000000 complex arith operations in 18 seconds
Performing 2000 fileaccess operations in 22 seconds
Performing 21 nested^5 operations in 21 seconds
Overall test executed in 87 seconds
real 1m47.776s
user 1m8.250s
sys 0m18.404s
----- End forwarded message -----
----- Forwarded message from Chris Trimble <chris@pdi.com> -----
Date: Tue, 19 May 1998 14:10:56 -0700
From: Chris Trimble <chris@pdi.com>
To: David Jeske <jeske@home.chat.net>
Subject: Re: script performance comparison
On Tue, May 19, 1998 at 11:23:33AM -0700, David Jeske wrote:
> Can you send me the Lua and Perl code for that too?
Sure, here you go.
> I finally got my machine up after hacking up a P-II fan cable out of
> somethine else. I still need to find that damn connector.
Cool. Now i have to find a desk and a chair!
- Chris
-- all_test.lua
-- A replication of the tests we did at Blue Sky for embedded langs in Lua
-- Chris Trimble
-- December 15, 1997
-- Index Accesses
function index_test(INDEX)
write(date())
local i = 0
local b = 0
local table = {}
while i < INDEX do
table[i] = i
i=i+1
end
i = 0
while i < INDEX do
b = b + table[i]
i=i+1
end
write(date())
write("Index test done\n");
end
-- System calls
function system_test(SYSCALLS)
write(date())
local i = 0
while i < SYSCALLS do
execute("echo test >/dev/null")
i=i+1
end
write(date())
write("System test done\n")
end
-- Basic FP arith
function basic_fp_test(BASEARITH)
write(date())
local i = 0
local j = 3.14159265359
local k = 3.14159265359
while i < BASEARITH do
j = (j * (1/2.71828182846)) + 2.71828182846
k = (k / 2.71828182846) - 2.71828182846
i = i + 1
end
write(date())
write("Basic FP test done\n")
end
-- Complex FP arith
function complex_fp_test(COMPLEXARITH)
write(date())
local i = 0
local j = 0
while i < COMPLEXARITH do
j = j + sin( 3.14159265359 )
j = j + sqrt ( 69.283848 )
i = i + 1
end
write(date())
write("Complex FP test done\n")
end
-- File access test
function file_access_test(FILEACCESS)
write(date())
local i = 0
while i < FILEACCESS do
if mod(i, 100) == 0 then write(i, " ") end
local j = 0
writeto("/tmp/tmp-test")
while j < 100 do
write("LUA LINE --> ", j, "\n")
j = j + 1
end
writeto()
j = 0
readfrom("/tmp/tmp-test")
while j < 100 do
s = read()
j = j + 1
end
readfrom()
i = i + 1
end
write(date())
write("File access test done\n")
end
-- Nested loop test
function nested_test(NESTED)
write(date())
local a = 0
local n = 0
while a < NESTED do
local b = 0
n = n + 0.0342
while b < NESTED do
local c = 0
n = n + 0.723
while c < NESTED do
local d = 0
n = n * 0.0342
while d < NESTED do
local e = 0
n = n * .723
while e < NESTED do
n = n - 0.0342
e = e + 1
end
d = d + 1
end
c = c + 1
end
b = b + 1
end
a = a + 1
end
write(date())
write("Nested test done")
end
-- Main
index_test(300000)
system_test(1000)
basic_fp_test(1000000)
complex_fp_test(2000000)
file_access_test(2000)
nested_test(20)
#!/bin/env perl
##---------------------------------------------------------------------------
## Index accesses
sub array {
use integer;
my($thisindex) = @_;
$before = time();
$a = $thisindex + 1;
while ( --$a ) {
push(@b, $a);
}
$a = $thisindex + 1;
$c = 0;
while ( --$a ) {
$c += $b[$a];
}
$after = time();
$total = $after - $before;
print"Performing $thisindex index operations in $total seconds\n";
return $total;
}
##-------------------------------------------------------------------------
## System Calls
sub system_calls {
use integer;
my($thissyscalls) = @_;
$before = time();
$i = $thissyscalls + 1;
while ( --$i ) {
system("echo test >/tmp/dummy");
}
$after = time();
$total = $after - $before;
print"Performing $thissyscalls syscall operations in $total seconds\n";
return $total;
}
##-------------------------------------------------------------------------
## Basic FP Arith
sub base_fp {
my($thisbasearith) = @_;
$before = time();
$i = $thisbasearith + 1;
$j = 3.14159265359;
$k = 3.14159265359;
while ( --$i ) {
no integer;
$j = ($j * (1 /2.71828182846)) + 2.71828182846;
$k = ($k / 2.71828182846) - 2.71828182846;
}
$after = time();
$total = $after - $before;
print"Performing $thisbasearith basic arith operations in $total seconds\n";
return $total;
}
##--------------------------------------------------------------------------
## Complex FP Arith
sub complex_fp {
my($thiscomplexarith) = @_;
$before = time();
$i = $thiscomplexarith + 1;
$j = 0;
while ( --$i ) {
no integer;
$j = j + sin( 3.14159265359 );
$j = j + sqrt( 69.283848 );
}
$after = time();
$total = $after - $before;
print"Performing $thiscomplexarith complex arith operations in $total seconds\n";
return $total;
}
##--------------------------------------------------------------------------
## File Access
sub file_stuff {
use integer;
my($thisfileaccess) = @_;
$before = time();
$i = $thisfileaccess + 1;
while ( --$i ) {
$j = 0;
open(MYOUTPUT,">/tmp/tmp") || die("Cannot open /tmp/tmp");
while ( ++$j <= 100 ) {
print MYOUTPUT "PRL LINE -> $j\n";
}
close (MYOUTPUT);
open(MYOUTPUT,"/tmp/tmp") || die("Cannot open /tmp/tmp");
$j = 0;
while ( <MYOUTPUT> ) {
++$j;
}
close (MYOUTPUT);
if ($j ne 100) {
print "WARNING: Retreived only $j lines!\n";
}
}
$after = time();
$total = $after - $before;
print"Performing $thisfileaccess fileaccess operations in $total seconds\n";
return $total;
}
##---------------------------------------------------------------------------
## Nested Loop Test
sub nest_stuff {
my($thisnested) = @_;
$before = time();
++$thisnested;
$n = 0;
$a = $thisnested;
while ( --$a ) {
$n += .0342;
$b = $thisnested;
while ( --$b ) {
$n += 0.723;
$c = $thisnested;
while ( --$c ) {
$n *= .0342;
$d = $thisnested;
while ( --$d ) {
$n *= .723;
$e = $thisnested;
while ( --$e ) {
$n -= .0342;
}
}
}
}
}
$after = time();
$total = $after - $before;
print"Performing $thisnested nested^5 operations in $total seconds\n";
return total;
}
$INDEX = 300000;
$SYSCALLS = 1000;
$BASEARITH = 1000000;
$COMPLEXARITH = 2000000;
$FILEACCESS = 2000;
$NESTED = 20;
print"Perl performance test -- PERL 5.004\n";
$total_time = array($INDEX);
$total_time += system_calls($SYSCALLS);
$total_time += base_fp($BASEARITH);
$total_time += complex_fp($COMPLEXARITH);
$total_time += file_stuff($FILEACCESS);
$total_time += nest_stuff($NESTED);
print"Overall test executed in $total_time seconds\n";
----- End forwarded message -----
--
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net