Sun, 06 Nov 2016 00:37:50 -0700 bdiff: don't check border condition in loop
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Nov 2016 00:37:50 -0700] rev 30308
bdiff: don't check border condition in loop `plast = a + len - 1`. So, this "for" loop iterates from "a" to "plast", inclusive. So, `p == plast` can only be true on the final iteration of the loop. So checking for it on every loop iteration is wasteful. This patch simply decreases the upper bound of the loop by 1 and adds an explicit check after iteration for the `p == plast` case. We can't simply add 1 to the initial value for "i" because that doesn't do the correct thing on empty input strings. `perfbdiff -m 3041e4d59df2` on the Firefox repo becomes significantly faster: ! wall 0.072763 comb 0.070000 user 0.070000 sys 0.000000 (best of 100) ! wall 0.053221 comb 0.060000 user 0.060000 sys 0.000000 (best of 100) For the curious, this code has its origins in 8b067bde6679, which is the changeset that introduced bdiff.c in 2005. Also, GNU diffutils is able to perform a similar line-based diff in under 20ms. So there's likely more perf wins to be found in this code. One of them is the hashing algorithm. But it looks like mpm spent some time testing hash collisions in d0c48891dd4a. I'd like to do the same before switching away from lyhash, just to be on the safe side.
Sat, 05 Nov 2016 23:41:52 -0700 perf: add perfbdiff
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 05 Nov 2016 23:41:52 -0700] rev 30307
perf: add perfbdiff bdiff shows up a lot in profiling. I think it would be useful to have a perf command that runs bdiff over and over so we can find hot spots.
Sun, 06 Nov 2016 06:54:31 +0530 help: show help for disabled extensions (issue5228)
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 06 Nov 2016 06:54:31 +0530] rev 30306
help: show help for disabled extensions (issue5228) This patch does not exactly solve issue5228 but it results in a better condition on this issue. For disabled extensions, we used to parse the module and get the first occurrences of docstring and then return the first line of that as an introductory heading of extension. This is what we get today. This patch returns the whole docstring of the module as a help for extension, which is more informative. There are some modules which don't have much docstring at top level except the heading so those are unaffected by this change. To follow the existing trend of showing commands either we have to load the extension or have a very ugly parsing method which don't even assure correctness.
Sun, 06 Nov 2016 04:17:19 +0530 py3: make scmutil.rcpath() return bytes
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 06 Nov 2016 04:17:19 +0530] rev 30305
py3: make scmutil.rcpath() return bytes This patch make sure scmutil.rcpath() returns bytes independent of which platform is used on Python 3. If we want to change type for windows we can just conditionalize the return variable.
Sun, 06 Nov 2016 04:10:33 +0530 py3: use pycompat.ossep at certain places
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 06 Nov 2016 04:10:33 +0530] rev 30304
py3: use pycompat.ossep at certain places Certain instances of os.sep has been converted to pycompat.ossep where it was sure to use bytes only. There are more such instances which needs some more attention and will get surely.
Sun, 06 Nov 2016 03:44:44 +0530 py3: have pycompat.ospathsep and pycompat.ossep
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 06 Nov 2016 03:44:44 +0530] rev 30303
py3: have pycompat.ospathsep and pycompat.ossep We needed bytes version of os.sep and os.pathsep in py3 as they return unicodes.
Sun, 06 Nov 2016 03:33:22 +0530 py3: add a bytes version of os.name
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 06 Nov 2016 03:33:22 +0530] rev 30302
py3: add a bytes version of os.name os.name returns unicodes on py3. Most of our checks are like os.name == 'nt' Because of the transformer, on the right hand side we have b'nt'. The condition will never satisfy even if os.name returns 'nt' as that will be an unicode. We either need to encode every occurence of os.name or have a new variable which is much cleaner. Now we have pycompat.osname. There are around 53 occurences of os.name in the codebase which needs to be replaced by pycompat.osname to support Python 3.
Sun, 06 Nov 2016 12:18:23 +0900 py3: make util.datapath a bytes variable
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 06 Nov 2016 12:18:23 +0900] rev 30301
py3: make util.datapath a bytes variable In this patch we make util.datapath a bytes variable, but we have to pass a unicode to gettext.translation otherwise it will cry. Used pycompat.fsdecode() to decode it back to unicode as it was converted to bytes using pycompat.fsencode().
Sun, 06 Nov 2016 03:12:40 +0530 py3: add os.fsdecode() as pycompat.fsdecode()
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 06 Nov 2016 03:12:40 +0530] rev 30300
py3: add os.fsdecode() as pycompat.fsdecode() We need to use os.fsdecode() but this was not present in Python 2. So added the function in pycompat.py
Fri, 04 Nov 2016 20:22:37 -0700 statprof: return state from stop()
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 04 Nov 2016 20:22:37 -0700] rev 30299
statprof: return state from stop() I don't like global variables. Have stop() return the captured state so callers can pass data to the display function.
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 +10000 tip