1996-12-13 - ASM vs portable code [WAS: Re: Java DES breaker?]

Header Data

From: “Peter Trei” <trei@process.com>
To: cypherpunks@toad.com
Message Hash: 99b83b86a4af2ca812f57748e4e453484b202d7ebdd4b6fcfdc44e670ca28247
Message ID: <199612131527.HAA07125@cygnus.com>
Reply To: N/A
UTC Datetime: 1996-12-13 18:17:01 UTC
Raw Date: Fri, 13 Dec 1996 10:17:01 -0800 (PST)

Raw message

From: "Peter Trei" <trei@process.com>
Date: Fri, 13 Dec 1996 10:17:01 -0800 (PST)
To: cypherpunks@toad.com
Subject: ASM vs portable code [WAS: Re: Java DES breaker?]
Message-ID: <199612131527.HAA07125@cygnus.com>
MIME-Version: 1.0
Content-Type: text/plain


Sorry if this is a repeat - I got a rather
opaque 'delivery failure' message when I 
first sent it. - pt


Ray Arachelian <sunder@brainlink.com> wrote:
> On Wed, 11 Dec 1996, Dr.Dimitri Vulis KOTM wrote:
> 
> > I happen to have a Sparc 20 box and a Linux box and a SCO box, and ActiveX
> > won't work on any of those. I also work with a bunch of other equipment
> > that's much faster than a PC, but doesn't run browsers. (Most of it is not
> > connected to the 'net for security reasons, but that's besides the point.)
> 
> Right, and Active X, if those machies were on the web, would not be 
> supported.
>  
> > If Bill's client is sure to run the platforms that MS IE runs on, then this is
> > not a consideration.
> 
> Correct, however there is one thing you have forgotten... (next paragraph)
> 
> > Interpreted FORTH bytestream (which is what Java is) may be "doing quite well"
> > when drawing GUI gizmos and widgets, but it can't get anywhere near the
> > performance of hand-optimizer assembler that you can stick into ActiveX.
> 
> While ActiveX does support hand optmized assembler, there are Java 
> JustInTime compilers which take JVM bytecodes and turn'em into raw 
> assembler.  They aren't hand optimized, they are natively compiled code, 
> but they are native code non the less.  A good optimizing compiler may 
> not be 100% as cool and as fast as hand optmized code, BUT it'll be 
> almost as fast.  And Java will run on just about EVERY platform out there.
> And that is a bigger, more important point than a 10%-25% increase in 
> power over non-optimized code.
> 
> Besides, I'm not arguing AGAINST an ActiveX client, there's no reason 
> why there can't be both Java and ActiveX clients out there since there is 
> both a compatibilty issue and a speed increase with ActiveX.

While I'm reluctant to ever find myself in the same corner as
Vulis, he has a point. As one of the few folks on this list who
actually writes code, I say that hand-optimized assembler will
beat machine generated code every time.

I have figures to back me up.

As some of you know, I've been working on a DES key recovery tool.
I'm have both portable C and x86 assembler versions. They
are currently identical, except that the guts of the DES round is 
written in "C" in one, and hand-optimized Pentium assembler in 
the other. 

For this test, I modified the code to cut out the delays associated 
with incrementing the key schedule (this is not in assembler yet, and
slows down the assembler version about 30%), leaving the of the 
crunching in the DES decryption. Both versions were compiled 
under Visual C++ 4.0, with Optimizations set to 'Maximize speed', 
and inlines to 'any suitable', and run on a 90MHz Digital 
Celebris 590 under WinNT 3.51.

Averaging several runs:

"C":   102,300 crypts/sec
ASM:   238,000 crypts/sec

With Java, it's possible to add native code methods to the 
interpreter, though it requires extra work by the user - 
it's harder than 'click on this link to run my reely 
kool applet'. This violates the Java sandbox, and requires 
the user to  make trust decisions on the methods they 
are adding.

ActiveX lets you add and run native code with a click, but
again involves trust decisions.

My philosophy is 'the more the merrier'. I'd like to see
able to people work on DES Key Recovery on a large number
of platforms and modes - we just need to standardize on 
the input and output formats.

Peter Trei
trei@process.com     





Thread