[PATCH 2 of 2] dirstate: avoid unnecessary load+dump during backup

Durham Goode durham at fb.com
Wed Mar 1 23:06:48 EST 2017


On 3/1/17 7:08 PM, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1488421266 28800
> #      Wed Mar 01 18:21:06 2017 -0800
> # Node ID c1f380ab1539b0dc0bd05f0ef2eb15b827453dbc
> # Parent  1e74c8187c9b98644ae35902c9e3faddad00f364
> # Available At https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=nuarHzhP1wi1T9iURRCj1A&m=Ltv4ypjmHC_b3dl-wNJ14scVlgAc4XjMCbW9vkwrU8s&s=ah37F78Eb6TE15sHQ44HEY-Aa1RpuecRnTgtRLmB_fA&e=
> #              hg pull https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=nuarHzhP1wi1T9iURRCj1A&m=Ltv4ypjmHC_b3dl-wNJ14scVlgAc4XjMCbW9vkwrU8s&s=ah37F78Eb6TE15sHQ44HEY-Aa1RpuecRnTgtRLmB_fA&e=  -r c1f380ab1539
> dirstate: avoid unnecessary load+dump during backup
>
> Previously, dirstate.savebackup unconditionally dumps the dirstate map to
> disk. It may require loading dirstate first to be able to dump it. Those
> operations could be expensive if the dirstate is big, and could be avoided
> if we know the dirstate file is up-to-date.
>
> This patch avoids the read and write if the dirstate is clean. In that case,
> we just do a plain copy without any serialization.
>
> This should make commands which use transactions but do not touch dirstate
> faster. For example, "hg bookmark -r REV NAME".

I wish we had macros in emails so I could say: superlike


More information about the Mercurial-devel mailing list