emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vlf ab20671 033/310: Abstract batch overlapping during


From: Stefan Monnier
Subject: [elpa] externals/vlf ab20671 033/310: Abstract batch overlapping during search and optimize a bit.
Date: Sat, 28 Nov 2020 00:32:41 -0500 (EST)

branch: externals/vlf
commit ab20671a934ebae3886daa162fff5fa92da004cf
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>

    Abstract batch overlapping during search and optimize a bit.
---
 vlfi.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/vlfi.el b/vlfi.el
index 302e8af..4156326 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -271,7 +271,7 @@ OP-TYPE specifies the file operation being performed over 
FILENAME."
                                (- vlfi-file-size vlfi-end-pos)
                              vlfi-start-pos)
                            vlfi-file-size))
-         (half-batch (/ vlfi-batch-size 2)))
+         (batch-step (/ vlfi-batch-size 8))) ; amount of chunk overlap
     (unwind-protect
         (catch 'end-of-file
           (if backward
@@ -284,11 +284,13 @@ OP-TYPE specifies the file operation being performed over 
FILENAME."
                                               (match-end 0))))
                       ((zerop vlfi-start-pos)
                        (throw 'end-of-file nil))
-                      (t (let ((half-move (- vlfi-start-pos half-batch)))
+                      (t (let ((batch-move (- vlfi-start-pos
+                                              (- vlfi-batch-size
+                                                 batch-step))))
                            (vlfi-move-to-batch
-                            (if (< match-start-pos half-move)
+                            (if (< match-start-pos batch-move)
                                 (- match-start-pos vlfi-batch-size)
-                              half-move)))
+                              batch-move)))
                          (goto-char (if (< match-start-pos
                                            vlfi-end-pos)
                                         (- match-start-pos
@@ -305,11 +307,11 @@ OP-TYPE specifies the file operation being performed over 
FILENAME."
                                             (match-end 0))))
                     ((= vlfi-end-pos vlfi-file-size)
                      (throw 'end-of-file nil))
-                    (t (let ((half-move (- vlfi-end-pos half-batch)))
+                    (t (let ((batch-move (- vlfi-end-pos batch-step)))
                          (vlfi-move-to-batch
-                          (if (< half-move match-end-pos)
+                          (if (< batch-move match-end-pos)
                               match-end-pos
-                            half-move)))
+                            batch-move)))
                        (goto-char (if (< vlfi-start-pos match-end-pos)
                                       (- match-end-pos vlfi-start-pos)
                                     (point-min)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]