[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bug-hunter 1778749 58/95: Improve bisection logic to av
From: |
Stefan Monnier |
Subject: |
[elpa] externals/bug-hunter 1778749 58/95: Improve bisection logic to avoid unnecessary step. |
Date: |
Fri, 27 Nov 2020 22:06:56 -0500 (EST) |
branch: externals/bug-hunter
commit 1778749362b198ff42c54cc6807a63c9bf97d671
Author: Artur Malabarba <bruce.connor.am@gmail.com>
Commit: Artur Malabarba <bruce.connor.am@gmail.com>
Improve bisection logic to avoid unnecessary step.
---
bug-hunter.el | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/bug-hunter.el b/bug-hunter.el
index 391d32c..207d664 100644
--- a/bug-hunter.el
+++ b/bug-hunter.el
@@ -262,25 +262,29 @@ ASSERTION is received by `bug-hunter--bisect-start'.
SAFE is a list of forms confirmed to not match the ASSERTION,
HEAD is a list of forms to be tested now, and TAIL is a list
which will be inspected if HEAD doesn't match ASSERTION."
- (cond
- ((not tail)
- (vector (length safe)
- ;; Sometimes we already ran this, sometimes not. So it's
- ;; easier to just run it anyway to get the return value.
- (bug-hunter--run-and-test (append safe head) assertion)))
- ((and (message "Testing: %s/%s"
- (cl-incf bug-hunter--i)
- bug-hunter--estimate)
- (setq bug-hunter--current-head head)
- (bug-hunter--run-and-test (append safe head) assertion))
- (apply #'bug-hunter--bisect
- assertion
- safe
- (bug-hunter--split head)))
- (t (apply #'bug-hunter--bisect
+ (message "Testing: %s/%s" (cl-incf bug-hunter--i) bug-hunter--estimate)
+ ;; Used if the user quits.
+ (setq bug-hunter--current-head head)
+ (let ((ret-val (bug-hunter--run-and-test (append safe head) assertion)))
+ (cond
+ ((not tail)
+ (cl-assert ret-val nil)
+ (vector (length safe) ret-val))
+ ;; Issue in the head.
+ ((and ret-val (< (length head) 2))
+ (vector (length safe) ret-val))
+ (ret-val
+ (apply #'bug-hunter--bisect
assertion
- (append safe head)
- (bug-hunter--split tail)))))
+ safe
+ (bug-hunter--split head)))
+ ;; Issue in the tail.
+ (t (apply #'bug-hunter--bisect
+ assertion
+ (append safe head)
+ ;; If tail has length 1, we already know where the issue is,
+ ;; but we still do this to get the return value.
+ (bug-hunter--split tail))))))
(defun bug-hunter--bisect-start (forms assertion)
"Run a bisection search on list of FORMS using ASSERTION.
- [elpa] externals/bug-hunter 95d6857 44/95: DOC, (continued)
- [elpa] externals/bug-hunter 95d6857 44/95: DOC, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter a0ed5ea 40/95: Move around variables, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 1d2f393 41/95: Report which expression caused an error., Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 1a050a0 57/95: Merge pull request #2 from lunaryorn/patch-1, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter c2f2d29 60/95: Note about init file idempotence, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 36b0594 67/95: Update comments, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter f9780b8 68/95: Style fixes, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 5075592 71/95: Inhibit readonly, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 5f61401 33/95: More tests, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter e903dd0 37/95: Ignore a dummy file, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 1778749 58/95: Improve bisection logic to avoid unnecessary step.,
Stefan Monnier <=
- [elpa] externals/bug-hunter 0794ccf 66/95: Merge pull request #8 from hariharanr5/master, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 0998393 70/95: Implement interactive assertion throughout, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 130cc12 45/95: Report what we can when the user aborts., Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 53a74dd 46/95: Whitespace, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter a4ba22d 49/95: checkdoc, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 91e1fea 50/95: Better Readme, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 5927de0 51/95: More verbose messages., Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 8d2d20e 63/95: Extended readme, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter 1232c89 64/95: Don't assume Emacs 24.4. Fix #5, Stefan Monnier, 2020/11/27
- [elpa] externals/bug-hunter c796137 69/95: bug-hunter--run-and-test accepts an 'interactive assertion, Stefan Monnier, 2020/11/27