info-sather
[Top][All Lists]
Advanced

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

Sather unjustly defamed


From: Sather User
Subject: Sather unjustly defamed
Date: Thu, 31 Mar 2011 17:36:47 +0930 (CST)

I plead guilty, Your Honor.

In a recent message to the GNU Sather list I wrote:

"Just playing with some benchmarks now (Doug Bagley's), I notice that
in a small number of them, Sather is faster than the C++ program
compiled with g++; in most it is faster than the Java program compiled
with gcj; in one it is faster than the C code; but it does relatively
poorly handling large arrays, an area where it once starred.  In
matrix handling, multiplying 30*30 square matices, it seems something
like half the speed of gcj code.  That is very bad and needs
attention."

The truth, I admit, is that the matrix multiplication times for C, C++
and Sather are scarcely distinguishable, whereas the Java code, as
compiled by gcj, is significantly slower.  Perhaps that is the fault
of gcj rather than the Java language itself.

I can only plead as an extenuating circumstance that I had the
environment variable SATHER_LIBRARY set when compiling Sather
benchmark programs.  Turns out that that makes quite a difference,
slows the Sather executable considerably.

I didn't know that previously, Your Honor.

No, Sir, I don't know why having SATHER_LIBRARY set at compile time
slows down the resulting executable.  Maybe it is something to do with
my own particular SATHER_LIBRARY file.  Just possibly it is not a
general problem, just some quirk in my file.

With your permission, Sir, I would like to volunteer some further
evidence.  Thank you.  I'm sure Doug Bagley meant well, but there are
a couple of issues with his matrix multiplication benchmark.  One is
that it muliplies matrices of integers, which is not what matrix
multiplication, linear algebra and such are about in the real world.
They should be matrices of real (or perhaps complex) numbers.

The other issue relates to the C++ program.  I could call evidence
which would prove that C++ is a kind of C language with
object-oriented features added.  You could get a long way into C++,
learning to write C++ programs, before you encountered the idea of a
class.  You would just be writing C.

But in a matrix multiplication benchmark comparing C++ with Sather, a
fully object-oriented language, it is not a valid approach to write
C-like code to malloc and multiply arrays.

What you need to do in C++ is introduce a Matrix class and a multiply
operation for objects of that class, culminating in a multiplication
statement that looks like:

        m3 = m1 * m2;

assigning the product of the matrices m1 and m2 to the matrix m3.
That is what the Sather code will naturally do (but with ":=" for
"="), that is the object oriented approach, and only something like
that, and not low-level C-like code in a C++ program, can provide a
valid benchmark comparison between C++ and Sather.

Yes, Sir, I will work on such a program, and bring it before the Court
at a later date.  Thank you for the adjournment.


-- 
Michael Talbot-Wilson



reply via email to

[Prev in Thread] Current Thread [Next in Thread]