From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f03ffdf470e3c559,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad.newshosting.com!newshosting.com!198.186.194.249.MISMATCH!transit3.readnews.com!news-xxxfer.readnews.com!news-out.readnews.com!postnews3.readnews.com!not-for-mail Date: Sat, 25 Oct 2008 20:57:12 -0400 From: "Peter C. Chapin" User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Interesting performance quirk. X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4903c066$0$28676$4d3efbfe@news.sover.net> Organization: SoVerNet (sover.net) NNTP-Posting-Host: 7b8fac00.news.sover.net X-Trace: DXC=LMI:cj29S6W:1[;=564oO_K6_LM2JZB_Sh?N190Ao3T]3?@`i3kGa5[^ZI31lGCJjZP]8nUj]EbCW X-Complaints-To: abuse@sover.net Xref: g2news2.google.com comp.lang.ada:8224 Date: 2008-10-25T20:57:12-04:00 List-Id: I'm working on a cryptographic library in Ada (it's a hobby project). In addition to unit tests I also plan to provide some benchmark programs since the performance of encryption and related algorithms is often of interest. My library is in it infancy right now but I do have (what I believe to be) a working implementation of Blowfish. So for fun I wrote a simple benchmark program to exercise my Blowfish implementation. My program encrypts a 1 MB array repeatedly and then decrypts it repeatedly. Aside from using -O2 I'm not doing anything fancy with compiler options nor have I made any particular effort to hand optimize the code... at least not yet ("make it right before you make it fast"). Now the interesting part. My main development system is a Windows XP laptop. On this system my "optimized" Blowfish benchmark encrypts or decrypts at about 11 MB/s (curiously decryption is a little faster than encryption, which seems odd). It also happens that I have OpenSUSE 10.2 Linux running on the same box in a VMware virtual machine. In that environment my benchmark encrypts or decrypts at fully 27 MB/s. It's over twice as fast! I'm using GNAT GPL 2008 in both cases with the same compiler options and exactly the same source code. I'm even using the same basic hardware although, as I said, one of my systems---the faster one---is a virtual machine. Should I be surprised at this performance difference? I wasn't expecting it. Note that I'm using Ada.Calendar.Clock to track execution time. At first I wondered if the virtual machine's notion of time was distorted in some way but, no... the program is definitely faster in the VM (it runs long enough so that the difference is speed is easily perceptible by a human). I don't really have a question or a problem with any of this, but I found it curious and I thought I'd post in case someone had some useful insight into what might be going on. Peter