Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120706225348.GA23072@openwall.com>
Date: Sat, 7 Jul 2012 02:53:48 +0400
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: Between 1.7.9-jumbo-3 and 1.7.9-jumbo-4 performance of --format=bf dropped by more than 20%

On Sat, Jul 07, 2012 at 12:04:15AM +0200, Frank Dittrich wrote:
> ... and stayed at this level.

This is bad news, but dealing with it might not be worth the effort and
complexity.  BF_X2 is currently compile-time only, and having it set to
1 (enabled) when compiling with gcc 4.2+ (there's a gcc version check in
x86-sse.h and x86-mmx.h) is beneficial on most(?) systems (on all those
I've tested; I don't have any Atom, though).  I tested this on P3, P4,
Core 2, Core i7 (first generation).  P2 should be the same as P3.  These
old CPUs are sort of relevant since we're talking 32-bit builds only.
(BF_X2 was always enabled in x86-64 builds since the time of BF_X2's
introduction in 2008.)  However, newer CPUs are also relevant e.g.
because we only support 32-bit builds for Windows currently.

For example, on P3 1.0 GHz, I got:

asm code (BF_X2 = 0): 171 c/s
gcc 4.0.0, BF_X2 = 1: 142 c/s
gcc 4.1.0, BF_X2 = 1: 190 c/s
gcc 4.2.0, BF_X2 = 1: 206 c/s

Versions newer than 4.2.0 behaved similar to 4.2.0 in this respect.

As you can see, even 4.1.0 provides some speedup, but it is less
certain, and IIRC there was a slowdown on P4 with that version (the code
did not fit in P4's trace cache, I think).

(BTW, 4.1.0 and 4.2.0 specifically have a bug that resulted in them
miscompiling BF_std.c's code at the time, but we include a workaround
for that now - slightly re-ordered source code lines.)

Changing BF_X2 from compile-time to runtime (and detecting Atom then)
would be an invasive change that would significantly add to source code
complexity.

We could revert to BF_X2 = 0, but that would hurt most uses of 32-bit
builds, most of which I guess are on non-Atom CPUs.

As a workaround, -x86-any build should regain the old speed for you.

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.