git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Marius Storm-Olsen <marius@trolltech.com>
To: Johannes Sixt <johannes.sixt@telecom.at>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] Add a new lstat implementation based on Win32 API, and make stat use that implementation too.
Date: Sun, 02 Sep 2007 20:44:08 +0200	[thread overview]
Message-ID: <46DB0478.8050402@trolltech.com> (raw)
In-Reply-To: <200709022016.54262.johannes.sixt@telecom.at>

[-- Attachment #1: Type: text/plain, Size: 4943 bytes --]

Johannes Sixt wrote:
> On Sunday 02 September 2007 16:51, Marius Storm-Olsen wrote:
>> This gives us a significant speedup when adding, committing and stat'ing
>> files. (Also, since Windows doesn't really handle symlinks, it's fine that
>> stat just uses lstat)
>>
>> Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
> 
> Your numbers show an improvement of 50% and more. That is terrific!

Yes, I was surprised myself about the impact. Didn't think it would make
_such_ a difference. And if you compare it to the results we had before
Linus' performance fix too, just checkout the performance improvements
we've had (based on Moe's test script):

    Before                        Now
    -------------------------     -------------------------
    Command: git init             Command: git init
    -------------------------     -------------------------
    real    0m0.031s              real       0m0.078s
    user    0m0.031s              user       0m0.031s
    sys     0m0.000s              sys        0m0.000s
    -------------------------     -------------------------
    Command: git add .            Command: git add .
    -------------------------     -------------------------
    real    0m19.328s             real       0m12.187s
    user    0m0.015s              user       0m0.015s
    sys     0m0.015s              sys        0m0.015s
    -------------------------     -------------------------
    Command: git commit -a...     Command: git commit -a...
    -------------------------     -------------------------
    real    0m30.937s             real       0m17.297s
    user    0m0.015s              user       0m0.015s
    sys     0m0.015s              sys        0m0.015s
    -------------------------     -------------------------
    3x Command: git-status        3x Command: git-status
    -------------------------     -------------------------
    real    0m19.531s             real       0m5.344s
    user    0m0.211s              user       0m0.015s
    sys     0m0.136s              sys        0m0.031s

    real    0m19.532s             real       0m5.390s
    user    0m0.259s              user       0m0.031s
    sys     0m0.091s              sys        0m0.000s

    real    0m19.593s             real       0m5.344s
    user    0m0.211s              user       0m0.015s
    sys     0m0.152s              sys        0m0.016s
    -------------------------     -------------------------
    Command: git commit...        Command: git commit...
             (single file)                 (single file)
    -------------------------     -------------------------
    real    0m36.688s             real       0m7.875s
    user    0m0.031s              user       0m0.015s
    sys     0m0.000s              sys        0m0.000s

> I'll test it out an put the patch into mingw.git. I hope you don't mind if I 
> also include your analysis and statistics in the commit message. It's worth 
> keeping around! BTW, which of your email addresses would you like registered 
> as author?

Sure, include the stats if you'd like. You can use
mstormo_git@storm-olsen.com for email address.

>> +		ext = strrchr(file_name, '.');
>> +		if (ext && (!_stricmp(ext, ".exe") ||
>> +			    !_stricmp(ext, ".com") ||
>> +			    !_stricmp(ext, ".bat") ||
>> +			    !_stricmp(ext, ".cmd")))
>> +			fMode |= S_IEXEC;
>> +		}
> 
> I'm slightly negative about this. For a native Windows project the executable 
> bit does not matter, and for a cross-platform project this check is not 
> sufficient, but can even become annoying (think of a file 
> named 'www.google.com'). So we can just as well spare the few cycles.

Ok, that's fine by me. It was only added for completeness, and with no
benefits I'd say we drop it too.

>> +		buf->st_size = fdata.nFileSizeLow; /* Can't use nFileSizeHigh, since
>> it's not a stat64 */
> 
> Here's an idea for the future: With this self-made stat() implementation it 
> should also be possible to get rid of Windows's native struct stat: Make a 
> private definition of it, too, and use all 64 bits.

Yep, that will shave off one assignment, bit-shift and addition. Quick
operations, but still worth while IMO. No point wasting cycles where we
don't have to.

>>  		return 0;
>> +	}
>> +	errno = ENOENT;
> 
> Of course we need a bit more detailed error conditions, most importantly 
> EACCES should be distinguished.

Right, you want to do that in a second commit?

>> +/* Make git on Windows use git_lstat and git_stat instead of lstat and
>> stat */ +int git_lstat(const char *file_name, struct stat *buf);
>> +int git_stat(const char *file_name, struct stat *buf);
>> +#define lstat(x,y) git_lstat(x,y)
>> +#define stat(x,y) git_stat(x,y)
> 
> I'd go the short route without git_stat() and
> 
> #define stat(x,y) git_lstat(x,y)

Please do, thanks.

--
.marius


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]

  reply	other threads:[~2007-09-02 18:44 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-02 14:49 Stats in Git Marius Storm-Olsen
2007-09-02 14:51 ` [PATCH] Add a new lstat implementation based on Win32 API, and make stat use that implementation too Marius Storm-Olsen
2007-09-02 14:57   ` Marius Storm-Olsen
2007-09-02 15:32   ` Reece Dunn
2007-09-02 16:09     ` Marius Storm-Olsen
2007-09-02 16:33       ` Reece Dunn
2007-09-02 16:47         ` Brian Gernhardt
2007-09-02 16:53           ` Reece Dunn
2007-09-02 17:05             ` Marius Storm-Olsen
2007-09-02 17:44               ` Johannes Schindelin
2007-09-02 17:58                 ` David Kastrup
2007-09-02 18:18                 ` Marius Storm-Olsen
2007-09-02 18:16   ` Johannes Sixt
2007-09-02 18:44     ` Marius Storm-Olsen [this message]
2007-09-02 19:07       ` Johannes Sixt
2007-09-02 19:31       ` Marius Storm-Olsen
2007-09-02 20:27         ` Robin Rosenberg
2007-09-02 21:26           ` Johannes Schindelin
2007-09-02 21:42             ` Robin Rosenberg
2007-09-02 23:02               ` Johannes Schindelin
2007-09-03  7:07               ` Johannes Sixt
2007-09-03 11:21                 ` Miklos Vajna
2007-09-03 11:32                   ` David Kastrup
2007-09-05 16:02                     ` Miklos Vajna
2007-09-05 19:01                       ` David Kastrup
2007-09-06 16:26                         ` Miklos Vajna
2007-09-06 16:33                           ` David Kastrup
2007-09-06 23:31                             ` Douglas Stockwell
2007-09-07  6:36                               ` David Kastrup
2007-09-02 21:38           ` Alex Riesen
2007-09-02 22:04             ` Robin Rosenberg
2007-09-03  6:15           ` Marius Storm-Olsen
2007-09-03 11:39             ` Johannes Schindelin
2007-09-03 11:51               ` David Kastrup
2007-09-03 11:53               ` Marius Storm-Olsen
2007-09-03 12:33                 ` Johannes Schindelin
2007-09-02 21:41         ` Alex Riesen
2007-09-03  6:12           ` Marius Storm-Olsen
2007-09-03  7:47   ` Johannes Sixt
2007-09-03  7:55     ` Marius Storm-Olsen
     [not found]     ` <46DBFA2A.7050003@trolltech.com>
2007-09-03 12:38       ` [PATCH] Add a new lstat and fstat implementation based on Win32 API Marius Storm-Olsen
2007-09-03 13:33       ` Johannes Schindelin
2007-09-03 13:52         ` Marius Storm-Olsen
2007-09-03 14:39           ` Johannes Schindelin
2007-09-03 16:22             ` Marius Storm-Olsen
2007-09-03 16:56               ` Johannes Schindelin
2007-09-03 13:53         ` Johannes Sixt
2007-09-03 14:35           ` Johannes Schindelin
2007-09-03 19:21         ` Marius Storm-Olsen
2007-09-04  2:21           ` Johannes Schindelin
2007-09-04  7:41           ` Johannes Sixt
2007-09-04  8:53             ` David Kastrup
2007-09-04 10:20             ` Marius Storm-Olsen
2007-09-04 10:53               ` Johannes Sixt
2007-09-04 11:21                 ` Marius Storm-Olsen
2007-09-04 11:28                   ` Johannes Sixt
2007-09-04 21:31                 ` David Kastrup
2007-09-04 10:48             ` Johannes Schindelin
2007-09-04 11:36               ` Johannes Sixt
2007-09-04 11:53                 ` Marius Storm-Olsen
2007-09-04 13:56                   ` Marius Storm-Olsen
2007-09-04 14:07                     ` Johannes Sixt
2007-09-04 14:32                       ` Johannes Schindelin
2007-09-04 14:52                         ` Johannes Sixt
2007-09-04 14:16                     ` Johannes Schindelin
2007-09-04 14:30                     ` Johannes Schindelin
2007-09-04 14:43                       ` Marius Storm-Olsen
2007-09-04 14:48                         ` Johannes Schindelin
2007-09-04 15:05                           ` David Kastrup
2007-09-04 16:32                           ` Marius Storm-Olsen
2007-09-04 12:46                 ` Johannes Schindelin
2007-09-04 12:57                   ` Johannes Schindelin
2007-09-04 21:02                     ` Rutger Nijlunsing
2007-09-04 21:54                       ` Reece Dunn
2007-09-05  6:22                       ` Marius Storm-Olsen
2007-09-05 10:15                         ` Johannes Schindelin
2007-09-04 13:03                   ` Johannes Sixt
2007-09-06 16:18             ` Johannes Sixt
2007-09-06 16:34               ` Marius Storm-Olsen
2007-09-03 13:49       ` Johannes Sixt
2007-09-03 14:38         ` Johannes Schindelin
2007-09-03 16:15           ` Marius Storm-Olsen
2007-09-03 16:55             ` Johannes Schindelin
2007-09-02 20:02 ` Stats in Git Alex Riesen
2007-09-02 20:09   ` Marius Storm-Olsen
2007-09-03  8:19 ` Matthieu Moy

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=46DB0478.8050402@trolltech.com \
    --to=marius@trolltech.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=johannes.sixt@telecom.at \
    /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).