comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <pcc482719@gmail.com>
Subject: Re: Interesting performance quirk.
Date: Tue, 28 Oct 2008 07:35:37 -0400
Date: 2008-10-28T07:35:37-04:00	[thread overview]
Message-ID: <4906f908$0$5781$4d3efbfe@news.sover.net> (raw)
In-Reply-To: <a630b4e2-2aab-4fc6-a015-15610e70f26d@j22g2000hsf.googlegroups.com>

Martin wrote:

> Any tasking involved?...

No, it's just one task. The program could easily be written with
multiple tasks since I'm just using ECB mode (so I could encrypt
different parts of the array in parallel). However, my intent is not to
make the benchmark program as fast as possible but rather measure the
encryption performance of my implementation. I want to avoid doing
things that would obscure that. By themselves the timings mean very
little; it's the comparisons that are interesting.

In further developments...

I wrote a version of the benchmark program in C that uses OpenSSL's
Blowfish implementation. The program is the "same" in that it creates
the same amount of data and processes it in the same way. The only
significant difference is that it calls into OpenSSL. It's quite a bit
faster. Right now I get

Windows XP Laptop (GNAT GPL 2008 for the Ada, Cygwin gcc for the C)
-----
My Library => 11 MB/s  (with -O2 option and no debugging support)
OpenSSL    => 65 MB/s  (Wow!)

SUSE Linux in a VM on the same box
-----
My Library => 25 MB/s  (odd)
OpenSSL    => 65 MB/s  (now this makes sense at least)

I'm expecting my code to be slower because a) It is Ada and there are
probably some extra run time checks, and b) I just wrote this thing and
I haven't yet tried to tweak it for performance. The performance ratio
on the Linux system between my immature Ada code and the much more
mature OpenSSL seems pretty reasonable to me. I'm less content with the
ratio in the Window XP environment.

On the other hand: on the Blowfish home page Schneier warns about a
common implementation error that greatly reduces the security of the
algorithm. I thought, "I better take a look at that." It turned out that
the problem was related to mixing signed and unsigned characters (in C
code, of course). I thought, "Hey, I don't have this problem and I
didn't even have to try!" :-)

I tried running gprof over my code to see what I could learn, but I
don't know how to use that tool very well yet so I didn't learn much. I
discovered that a certain procedure is called a HUGE number of times,
but that's not unexpected considering where it's used. It's a small
procedure so I might try inlining it.

Anyway I'm having fun and considering that this is a hobby project
that's what matters. :-)

Peter



  reply	other threads:[~2008-10-28 11:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-26  0:57 Interesting performance quirk Peter C. Chapin
2008-10-26  2:15 ` Jeffrey Creem
2008-10-26 11:16   ` Peter C. Chapin
2008-10-26  4:57 ` tmoran
2008-10-26 11:11   ` Peter C. Chapin
2008-10-28  8:49     ` Martin
2008-10-28 11:35       ` Peter C. Chapin [this message]
2008-10-28 14:21         ` Robert A Duff
2008-10-29  1:42           ` Peter C. Chapin
2008-10-28 18:27         ` Jeffrey R. Carter
2008-10-29  1:39           ` Peter C. Chapin
2008-10-29  5:27             ` Jeffrey R. Carter
2008-10-28 23:22         ` Ludovic Brenta
2008-10-29  8:42           ` oenone
2008-10-29  9:59           ` Peter C. Chapin
2008-10-29 10:19             ` Martin
2008-11-17  6:31             ` David Thompson
2008-11-17 11:51               ` Peter C. Chapin
2008-10-29  9:54         ` Alex R. Mosteo
2008-10-30 11:16           ` Peter C. Chapin
2008-10-29 16:12         ` Colin Paul Gloster
2008-10-30 11:23           ` Peter C. Chapin
2008-10-31 13:41             ` Colin Paul Gloster
2008-11-01 15:41               ` Gene
2008-10-29 20:18 ` Florian Weimer
2008-10-30 11:15   ` Peter C. Chapin
2008-11-07  0:44 ` Randy Brukardt
2008-11-07  1:23   ` Peter C. Chapin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox