8000 gh-63416: Speed up assertEqual on long sequences by jdevries3133 · Pull Request #27434 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-63416: Speed up assertEqual on long sequences #27434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 37 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
20fde31
Fix bpo-19217
eamanu Dec 17, 2018
6996d8a
fix unnecessary space and solve @gpshead comments
eamanu Dec 18, 2018
adfcf6d
fix test
Dec 18, 2018
ddebcfa
Merge remote-tracking branch 'temp/fix_bpo-19217' into bpo-19217-slow…
jdevries3133 Jul 22, 2021
81900d4
bpo-19217: fix failing test in unittest's test suite
jdevries3133 Jul 22, 2021
e5cb7bc
bpo-19217: add blurb
jdevries3133 Jul 22, 2021
6955d81
revert changes to difflib.py
jdevries3133 Jul 22, 2021
46f5e29
add regression test
jdevries3133 Jul 22, 2021
847bfc4
Merge branch 'main' of github.com:python/cpython into bpo-19217-slow-…
jdevries3133 Aug 3, 2021
856029d
draft implementation of unittest.case._heuristic_diff
jdevries3133 Aug 4, 2021
1dd1bcd
fix: remove now-unused imports from test_case.py
jdevries3133 Aug 4, 2021
1f45b28
merge upstream python/cpython:main
jdevries3133 Aug 12, 2021
988740a
add variably scaled test cases, misc updates & revisions
jdevries3133 Aug 12, 2021
4661f75
move Test_HeuristicDiff beneath main tests
jdevries3133 Aug 12, 2021
a9d23c4
remove unnecessary list comprehension in Lib/unittest/case.py
jdevries3133 Aug 13, 2021
192d7a4
spelling error in Lib/unittest/test/test_case.py
jdevries3133 Aug 13, 2021
74895e9
implement second review from @ambv
jdevries3133 Aug 13, 2021
e21dbe3
merge changes from PR suggestions
jdevries3133 Aug 13, 2021
5e8a186
Merge branch 'main' of github.com:python/cpython into bpo-19217-slow-…
jdevries3133 Jan 29, 2022
28cb042
fix from @JelleZijlstra
jdevries3133 Jan 29, 2022
63ecc45
fix from @JelleZijlstra
jdevries3133 Jan 29, 2022
e4344cb
remove unnecessary type checker supression
jdevries3133 Jan 29, 2022
0bdf06c
fix typo
jdevries3133 Jan 29, 2022
05ffdf2
simplify tuple syntax
jdevries3133 Jan 29, 2022
5767d21
fix news entry "~lists~ => sequenecs"
jdevries3133 Jan 29, 2022
b9f2f9d
better document the reasoning behind the heuristic
jdevries3133 Jan 29, 2022
5351506
thanks @JelleZijlstra
jdevries3133 Jan 29, 2022
872de08
thanks @JelleZijlstra
jdevries3133 Jan 29, 2022
180c732
fix whitespace around keyword argument
jdevries3133 Jan 29, 2022
200a1a7
Merge branch 'bpo-19217-slow-assertEq' of github.com:jdevries3133/cpy…
jdevries3133 Jan 29, 2022
fc752cf
update blurb to describe observable changes
jdevries3133 Feb 7, 2022
b53738f
Merge branch 'main' of github.com:python/cpython into bpo-19217-slow-…
jdevries3133 Feb 7, 2022
adc7d6f
reword to make less promises
gpshead Feb 8, 2022
c4d6f38
Merge branch 'main' of github.com:python/cpython into bpo-19217-slow-…
jdevries3133 Feb 8, 2022
9e6a464
Merge branch 'bpo-19217-slow-assertEq' of github.com:jdevries3133/cpy…
jdevries3133 Feb 8, 2022
0ad029f
Merge remote-tracking branch 'upstream/main' into bpo-19217-slow-asse…
AA-Turner Apr 9, 2025
4c5175c
Remove annotations
AA-Turner Apr 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reword to make less promises
unified diff is not "fast" just "less likely slow" or "slow in different circumstances".  so this doesn't ensure the problem never happens, it just reduces its chance.
  • Loading branch information
gpshead authored Feb 8, 2022
commit adc7d6f92818b3e64a652ff290d900b1dfae0caf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ items. Based on an internal heuristic, the algorithm used to produce the diff
method will switch based on the relevant magnitude of inputs. As a result, diff
output after a failing assertion may appear differently for large inputs.
Specifically, unittest will internally switch from using :func:`difflib.ndiff`
(slow) to using :func:`difflib.unified_diff` (fast).
(slow) to using :func:`difflib.unified_diff` (less likely to be slow).

This optimization ensures that the non-linear time complexity of
:func:`difflib.ndiff` does not cause a test suite to hang.
This optimization reduces that chance that non-linear time complexity of
diff algorithms do not cause a test suite's failing test to hang.
0