Commit Graph

4 Commits

Author SHA1 Message Date
Siddharth Agarwal
663e918bc2 dicthelpers.diff: compare against default for missing values
This is not only a bit faster, but also aligns with callers' expectations
better since we can legitimately have manifestdict's _flags set to '' instead
of unset.

hg perfmergecalculate -r .
before: ! wall 0.139582 comb 0.140000 user 0.140000 sys 0.000000 (best of 59)
after:  ! wall 0.126154 comb 0.120000 user 0.120000 sys 0.000000 (best of 74)

hg perfmergecalculate -r .^
before: ! wall 0.236333 comb 0.240000 user 0.240000 sys 0.000000 (best of 36)
after:  ! wall 0.212265 comb 0.210000 user 0.210000 sys 0.000000 (best of 45)
2013-04-10 12:31:07 -07:00
Siddharth Agarwal
c21872bb74 dicthelpers: inline diff and join code
mpm suggested this change since it improves performance slightly.

Benchmarking hg perfcalculate -r .

Before:
! wall 0.141173 comb 0.140000 user 0.140000 sys 0.000000 (best of 66)

After:
! wall 0.138619 comb 0.140000 user 0.140000 sys 0.000000 (best of 69)
2013-03-29 16:07:57 -07:00
Siddharth Agarwal
2b341c44b5 dicthelpers: add docstrings for diff and join 2013-03-29 15:23:19 -07:00
Siddharth Agarwal
b037c134fd mercurial: implement diff and join for dicts
Given two dicts, diff returns a dict containing all the keys that are present
in one dict but not the other, or whose values are different between the
dicts. The values are pairs of the values from the dicts, with missing values
being represented as an optional argument, defaulting to None.

Given two dicts, join performs what is known as an outer join in relational
database land: it returns a dict containing all the keys across both dicts.
The values are pairs as above, except they aren't compared to see if they're
the same.
2013-03-25 17:40:39 -07:00