mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1199] 29% performance regression for --format=bcrypt #748
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#748
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @frank-dittrich on GitHub (Apr 11, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1199
Originally assigned to: @solardiz on GitHub.
On 64bit Linux:
So, for some reasons, merging Solar's core changes caused this performance regression on my hardware:
@frank-dittrich commented on GitHub (Apr 11, 2015):
BTW:
Looks like you just missed some performance improvement bleeding-jumbo had over core john after you merged Solar's changes.
Core 1.8.0:
jumbo 1:
Note the X2 vs. X3 difference
@frank-dittrich commented on GitHub (Apr 11, 2015):
Apparently, the BF related changes of commit
f64b42fee9make the difference.If I build linux-x86-64-native for this commit (this was before autoconf got introduced), I get
With
f212f89875, I get@magnumripper commented on GitHub (Apr 11, 2015):
Try the latest core code from the master branch (
d686010da) versus 1.8.0. Doesn't it show the same problem?Note: You have to build for AVX or XOP for a comparable build.
@frank-dittrich commented on GitHub (Apr 11, 2015):
Apparently, on well the current logic is almost 5 percent faster than the one which works best for me.
May be that's why Solar didn't enable this logic for avx.
When I test commit
d686010da1(latest master commit) on my system (linux-x86-65-native), I getSimilar for a generic build:
Apparently,
Blowfish 32/64 X3is not tested in a generic build:May be the benchmark should try X > 2, as long as the resulting c/s rate increases?
And may be we need to introduce --benchmark into out ./configure script?
@frank-dittrich commented on GitHub (Apr 11, 2015):
BTW, this patch to master helps creating a generic build with improved bcrypt performance for my system:
Tomorrow (after I got some sleep) I'll report my findings to john-dev, so that Solar can improve the generic build and may be reconsider setting BF_X2 to 3 even for avx systems.
@frank-dittrich commented on GitHub (Apr 12, 2015):
I reported the regression here:
http://openwall.com/lists/john-dev/2015/04/12/4
http://thread.gmane.org/gmane.comp.security.openwall.john.devel/11239
Unfortunately, I forgot a link to this issue.
@frank-dittrich commented on GitHub (Apr 12, 2015):
Some more data:
Intel(R) Core(TM) i7-2820QM CPU @ 2.30GHz (quad core with HT), generic build without OMP, also a 23% improvement:
With OMP enabled (8*OMP due to HT), just a 2% performance improvement:
With OMP_NUM_THREADS=4, a 25% improvement:
@jfoug commented on GitHub (Aug 31, 2015):
I have built on all 3 types (AVX, XOP, AVX2). I see improvements to all processors.
AVX2 I see abotu 25% or so (as what was reported by @frank-dittrich). XOP I see about 12% improvement, and AVX I see about 15% improvement.
But for all systems I have that are >= AVX I am seeing BF_X2=3 to be an improvement over BF_X2=1
@frank-dittrich commented on GitHub (Aug 31, 2015):
I have a 36% performance improvement when changing BF_X2 from 1 to 3 for my i5-4570 CPU (quad core with AVX2 and ht, but number of logical cores = number of physical cores = 4), but Solar found a regression (either on super or on well or even on both) for BF_X2 = 3 compered ro BF_X2 = 1.
@jfoug commented on GitHub (Sep 1, 2015):
I wonder if this should be a configuration check, and not hard coded into x86-64.h ? @magnumripper what do you think about that idea? Or at least a configure check, that can OVERRIDE the value in x86-64.h
@frank-dittrich commented on GitHub (Sep 1, 2015):
What kind of check do you have in mind?
Something similar to the benchmark for
make -f Makefile.legacy generic, except that you would try BF_X2 = 3 as well?But then the build process can pick non-optimal values depending on varying system load.
@frank-dittrich commented on GitHub (Sep 1, 2015):
May be we have to repeat Solar's test on super and well. The performance regression or improvement could also depend on compiler version.
@magnumripper commented on GitHub (Sep 1, 2015):
I'm open for configure-time benchmarking, but it does have the caveat @frank-dittrich mentioned with system load.
If nothing else, we should wrap any
#define BF_X2in arch.h's with#ifndef BF_X2 ... #endif. That would mean you can override it at configure time (we wouldn't really need to add any option for it, just add it to CFLAGS or CPPFLAGS).@jfoug commented on GitHub (Sep 1, 2015):
That is a viable alternative (the CPPFLAGS). It would be nice to find out the 'truth' about the regression. Possibly it was only OMP builds or something. From what I have seen it runs faster on all of my systems (xop, avx and avx2). Both under windows (cygwin), and a linux-64 VM. BUT by reading the comment, this is due to SMT-capable CPU's . Could that be something that is turned on, when running physical installed unix on these CPU's ?
But like frank mentioned, it may also be compiler version dependent and was a bug that has been fixed.
@magnumripper commented on GitHub (Sep 1, 2015):
Done.
@magnumripper commented on GitHub (Sep 1, 2015):
i7-3615QM (Ivy Bridge, AVX), OSX, gcc 4.9.2
Non-OMP build:
OMP w/o HT:
OMP w/ HT:
Improvement for X3 is 21-27% without HT. It's just 4% with HT - but still an improvement.
@magnumripper commented on GitHub (Nov 13, 2015):
github.com/magnumripper/JohnTheRipper@14685372f4 (commitcomment-14375823)@magnumripper commented on GitHub (Nov 13, 2015):
@frank-dittrich please test on that non-HT hardware you've got. We are now checking for hyperthreading with a cpuid call in autoconf, and use the results accordingly.
@magnumripper commented on GitHub (Nov 13, 2015):
I'm not sure whether we should set X3 even for HT machines when not building OpenMP. I think I recall Solar argued against it (because X2 should be better for -fork too).
@magnumripper commented on GitHub (Nov 13, 2015):
BTW the test runs fine on 32-bit too but I did not touch x86-sse2.h
@frank-dittrich commented on GitHub (Nov 13, 2015):
@magnumripper I did test on my CPU. /proc/cpuinfo reports ht capability, and autoconf detects ht capability, so BF_X2 is defined as 1. But 3 would be much better for my CPU.
Do we have a recent compiler version (gcc >= 5.0) on those systems where we see a regression with BF_X2 = 3? May be the value of BF_X2 should depend on gcc version?
@magnumripper commented on GitHub (Nov 13, 2015):
When actually using all available threads too?
I use gcc 5.2.0 and I definitely see a regression when running X3. That's measured with HT in use.
@jfoug commented on GitHub (Nov 13, 2015):
It should not only depend upon compiler version. But right now, it bases 100% on the HT bit. That is not right logic either.
I use non-omp build running on 6 cores (with fork and a few stand alone), and it is MUCH faster than when built with X2=1. It also allows the machine to be useful. There is a tiny gain going to 7 runs, and almost none going to 8 threads. But even at 8 threads, it IS faster than OMP, and faster than X2=1 for fork=8
@magnumripper commented on GitHub (Nov 13, 2015):
Then we should challenge Solar's statements in that thread on john-dev.
@magnumripper commented on GitHub (Nov 13, 2015):
You can obviously still
./configure CPPFLAGS=-DBF_X2=3if you like. That overrules everything else.@jfoug commented on GitHub (Nov 13, 2015):
Just got this message:
"Sorry, AVX2 is required for this build"
Running on virtualbox. AVX2 worked just fine, until you added runtime checks.
@magnumripper commented on GitHub (Nov 13, 2015):
That's odd. It's well tested.
@magnumripper commented on GitHub (Nov 13, 2015):
Could my addition of HAVE_HT have had this side effect?
@jfoug commented on GitHub (Nov 13, 2015):
configure has given me AVX2 for a while (an update to VirtualBox about a year ago), and configure worked, as did all formats, doing AVX2
@jfoug commented on GitHub (Nov 13, 2015):
I am testing on cygwin-64 Nope, that one works fine.
@magnumripper commented on GitHub (Nov 13, 2015):
I gave in and set it to 3 for non-OpenMP builds. It's unreasonable not to do so IMHO.
@magnumripper commented on GitHub (Nov 13, 2015):
On a side note I updated my fallback wiki page to include "native CPU, but with OpenMP fallback"
@jfoug commented on GitHub (Nov 16, 2015):
Here is on my CoreI7-HT AVX machine. X3 is quite a bit better, and much more 'stable'
$ ../run/john -test=5 -form=bcrypt
Will run 8 OpenMP threads
Benchmarking: bcrypt ("$2a$05", 32 iterations) [Blowfish 32/64 X2]... (8xOMP) DONE
Speed for cost 1 (iteration count) of 32
Raw: 4322 c/s real, 602 c/s virtual
$ ../run/john -test=5 -form=bcrypt
Will run 8 OpenMP threads
Benchmarking: bcrypt ("$2a$05", 32 iterations) [Blowfish 32/64 X2]... (8xOMP) DONE
Speed for cost 1 (iteration count) of 32
Raw: 3936 c/s real, 614 c/s virtual
$ ../run/john -test=5 -form=bcrypt
Will run 8 OpenMP threads
Benchmarking: bcrypt ("$2a$05", 32 iterations) [Blowfish 32/64 X2]... (8xOMP) DONE
Speed for cost 1 (iteration count) of 32
Raw: 4118 c/s real, 607 c/s virtual
$ ../run/john -test=5 -form=bcrypt
Will run 8 OpenMP threads
Benchmarking: bcrypt ("$2a$05", 32 iterations) [Blowfish 32/64 X3]... (8xOMP) DONE
Speed for cost 1 (iteration count) of 32
Raw: 4538 c/s real, 625 c/s virtual
$ ../run/john -test=5 -form=bcrypt
Will run 8 OpenMP threads
Benchmarking: bcrypt ("$2a$05", 32 iterations) [Blowfish 32/64 X3]... (8xOMP) DONE
Speed for cost 1 (iteration count) of 32
Raw: 4571 c/s real, 617 c/s virtual
$ ../run/john -test=5 -form=bcrypt
Will run 8 OpenMP threads
Benchmarking: bcrypt ("$2a$05", 32 iterations) [Blowfish 32/64 X3]... (8xOMP) DONE
Speed for cost 1 (iteration count) of 32
Raw: 4536 c/s real, 609 c/s virtual
I am sorry, I still argue that the proper setting is 3x, always.
@jfoug commented on GitHub (Nov 16, 2015):
Is there any way to build both X2=1 and X2=3, and have runtime selection of the proper code?
@frank-dittrich commented on GitHub (Nov 16, 2015):
@jfoug Apparently, you didn't test combinations of X2=1 and X2=3 (non-OMP) for max. number of logical cores.
When I tested on my laptop (
Intel(R) Core(TM) i7-2820QM CPU @ 2.30GHzquad core, 8 logical cores), the best total combined c/s rate required running a mix of X2=1 and X2=3 binaries, while for just a single binary (or up to 4 binaries) X2=3 was better.@magnumripper commented on GitHub (Nov 16, 2015):
Solar will fix it eventually, in JP. He already mentioned it.
You are arguing that a regression for me is the proper setting. There's no point in arguing about something that vary among CPUs. Besides, you should argue on john-dev, not here. This may trigger Solar to make the canonical fix.
@frank-dittrich commented on GitHub (Mar 18, 2016):
Wow, you assigned 25 issues to me in just one minute.
Looking into all of these 25 issues will definitely take a little longer.
@magnumripper commented on GitHub (Mar 19, 2016):
Heh, I just picked issues with no assignee and that was opened by you. I intend to do so with other openers too.
@magnumripper commented on GitHub (Apr 10, 2019):
This is now "fixed" in core (actually X3 is always used) and we shall never mention it again