Mercurial > hg
annotate mercurial/mergeutil.py @ 43271:99394e6c5d12
rust-dirstate-status: add first Rust implementation of `dirstate.status`
Note: This patch also added the rayon crate as a Cargo dependency. It will
help us immensely in making Rust code parallel and easy to maintain. It is
a stable, well-known, and supported crate maintained by people on the Rust
team.
The current `dirstate.status` method has grown over the years through bug
reports and new features to the point where it got too big and too complex.
This series does not yet improve the logic, but adds a Rust fast-path to speed
up certain cases.
Tested on mozilla-try-2019-02-18 with zstd compression:
- `hg diff` on an empty working copy:
- c: 1.64(+-)0.04s
- rust+c before this change: 2.84(+-)0.1s
- rust+c: 849(+-)40ms
- `hg commit` when creating a file:
- c: 5.960s
- rust+c before this change: 5.828s
- rust+c: 4.668s
- `hg commit` when updating a file:
- c: 4.866s
- rust+c before this change: 4.371s
- rust+c: 3.855s
- `hg status -mard`
- c: 1.82(+-)0.04s
- rust+c before this change: 2.64(+-)0.1s
- rust+c: 896(+-)30ms
The numbers are clear: the current Rust `dirstatemap` implementation is super
slow, its performance needs to be addressed.
This will be done in a future series, immediately after this one, with the goal
of getting Rust to be at least to the speed of the Python + C implementation
in all cases before the 5.2 freeze. At worse, we gate dirstatemap to only be used
in those cases.
Cases where the fast-path is not executed:
- for commands that need ignore support (`status`, for example)
- if subrepos are found (should not be hard to add, but winter is coming)
- any other matcher than an `alwaysmatcher`, like patterns, etc.
- with extensions like `sparse` and `fsmonitor`
The next step after this is to rethink the logic to be closer to
Jane Street's Valentin Gatien-Baron's Rust fast-path which does a lot less
work when possible.
Differential Revision: https://phab.mercurial-scm.org/D7058
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Fri, 11 Oct 2019 13:39:57 +0200 |
parents | 8ff1ecfadcd1 |
children | 32ce4cbaec4b |
rev | line source |
---|---|
30494
c1149533676b
checkunresolved: move to new package to help avoid import cycles
Augie Fackler <augie@google.com>
parents:
30493
diff
changeset
|
1 # mergeutil.py - help for merge processing in mercurial |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
2 # |
4635
63b9d2deed48
Updated copyright notices and add "and others" to "hg version"
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4633
diff
changeset
|
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
4 # |
8225
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
8210
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
10263 | 6 # GNU General Public License version 2 or any later version. |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
7 |
28322
ebd0e86bdf89
cmdutil: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28313
diff
changeset
|
8 from __future__ import absolute_import |
ebd0e86bdf89
cmdutil: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28313
diff
changeset
|
9 |
ebd0e86bdf89
cmdutil: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28313
diff
changeset
|
10 from .i18n import _ |
ebd0e86bdf89
cmdutil: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28313
diff
changeset
|
11 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
30494
diff
changeset
|
12 from . import error |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
30494
diff
changeset
|
13 |
19211
3bfd7f1e7485
summary: augment output with info from extensions
Bryan O'Sullivan <bryano@fb.com>
parents:
19129
diff
changeset
|
14 |
30272
3d38a0bc774f
cmdutil: refactor checkunresolved
timeless <timeless@mozdev.org>
parents:
30182
diff
changeset
|
15 def checkunresolved(ms): |
3d38a0bc774f
cmdutil: refactor checkunresolved
timeless <timeless@mozdev.org>
parents:
30182
diff
changeset
|
16 if list(ms.unresolved()): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
30494
diff
changeset
|
17 raise error.Abort( |
43117
8ff1ecfadcd1
cleanup: join string literals that are already on one line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43077
diff
changeset
|
18 _(b"unresolved merge conflicts (see 'hg help resolve')") |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
30494
diff
changeset
|
19 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
20 if ms.mdstate() != b's' or list(ms.driverresolved()): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
30494
diff
changeset
|
21 raise error.Abort( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
22 _(b'driver-resolved merge conflicts'), |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
23 hint=_(b'run "hg resolve --all" to resolve'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
30494
diff
changeset
|
24 ) |