git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org, Jeff Hostetler <jeffhost@microsoft.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] mingw: use OpenSSL's SHA-1 routines
Date: Fri, 10 Feb 2017 00:02:37 -0500	[thread overview]
Message-ID: <20170210050237.gajicliueuvk6s5d@sigill.intra.peff.net> (raw)
In-Reply-To: <6a29f8c60d315a24292c1fa9f5e84df4dfdbf813.1486679254.git.johannes.schindelin@gmx.de>

On Thu, Feb 09, 2017 at 11:27:49PM +0100, Johannes Schindelin wrote:

> From: Jeff Hostetler <jeffhost@microsoft.com>
> 
> Use OpenSSL's SHA-1 routines rather than builtin block-sha1 routines.
> This improves performance on SHA1 operations on Intel processors.
> 
> OpenSSL 1.0.2 has made considerable performance improvements and
> support the Intel hardware acceleration features.  See:
> https://software.intel.com/en-us/articles/improving-openssl-performance
> https://software.intel.com/en-us/articles/intel-sha-extensions
> 
> To test this I added/staged a single file in a gigantic
> repository having a 450MB index file.  The code in read-cache.c
> verifies the header SHA as it reads the index and computes a new
> header SHA as it writes out the new index.  Therefore, in this test
> the SHA code must process 900MB of data.  Testing was done on an
> Intel I7-4770 CPU @ 3.40GHz (Intel64, Family 6, Model 60) CPU.

I think this is only half the story. A heavy-sha1 workload is faster,
which is good. But one of the original reasons to prefer blk-sha1 (at
least on Linux) is that resolving libcrypto.so symbols takes a
non-trivial amount of time. I just timed it again, and it seems to be
consistently 1ms slower to run "git rev-parse --git-dir" on my machine
(from the top-level of a repo).

1ms is mostly irrelevant, but it adds up on scripted workloads that
start a lot of git processes. Whether it's a net win or not depends on
how much sha1 computation you do in your workload versus how many
processes you start.

I don't know what that means for Windows, though. My impression is that
process startup is so painfully slow there that the link time may just
be lost in the noise. It may just always be a win there. So not really
an objection to your patch, but something you may want to consider.

(Of course, it would in theory be possible to have the best of both
worlds either by static-linking openssl, or by teaching block-sha1 the
same optimizations, but both of those are obviously much more complex).

-Peff

  parent reply	other threads:[~2017-02-10  5:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 22:27 [PATCH] mingw: use OpenSSL's SHA-1 routines Johannes Schindelin
2017-02-09 23:41 ` Junio C Hamano
2017-02-11  8:01   ` Johannes Sixt
2017-02-11 18:51     ` Junio C Hamano
2017-02-13 17:16     ` Johannes Schindelin
2017-02-16 18:12       ` Johannes Sixt
2017-02-10  5:02 ` Jeff King [this message]
2017-02-10 15:49   ` Johannes Schindelin
2017-02-10 16:04     ` Jeff King
2017-02-13 17:46       ` Johannes Sixt
2017-02-13 19:42         ` Junio C Hamano
2017-02-13 21:07           ` Johannes Sixt
2017-02-13 22:38             ` Johannes Schindelin
2017-02-14  6:14               ` Johannes Sixt
2017-02-24 21:54         ` Junio C Hamano
2017-03-02  6:07           ` Johannes Sixt
2017-03-02 17:07             ` Junio C Hamano
2017-02-25  0:44   ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170210050237.gajicliueuvk6s5d@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).