[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/el-job 40f86f79fc 028/143: Clarifications
From: |
ELPA Syncer |
Subject: |
[elpa] externals/el-job 40f86f79fc 028/143: Clarifications |
Date: |
Sat, 22 Mar 2025 00:58:22 -0400 (EDT) |
branch: externals/el-job
commit 40f86f79fcd49fb9b65e7b3e2bd47c370389526b
Author: Martin Edström <meedstrom91@gmail.com>
Commit: Martin Edström <meedstrom91@gmail.com>
Clarifications
---
el-job.el | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/el-job.el b/el-job.el
index ef24c91751..f7dac266ed 100644
--- a/el-job.el
+++ b/el-job.el
@@ -99,9 +99,10 @@ Note: if you are currently editing the source code for
FEATURE, use
(unless loaded
(error "Current Lisp definitions must come from a file %S[.el/.elc/.eln]"
feature))
- ;; HACK: Sometimes comp.el makes freefn- temp files; pretend we found .el.
- ;; Bad hack, because load-path is NOT as trustworthy as load-history
- ;; (current Emacs may not be using the thing in load-path).
+ ;; HACK: Sometimes comp.el makes freefn- temp files; pretend we found the
+ ;; .el that's in load-path, instead. Bad hack, because load-path is
+ ;; NOT as trustworthy as load-history (current Emacs may not be using
+ ;; the thing in load-path).
(when (string-search "freefn-" loaded)
(setq loaded
(locate-file (symbol-name feature) load-path '(".el" ".el.gz"))))
@@ -147,9 +148,7 @@ Note: if you are currently editing the source code for
FEATURE, use
loaded)))
;; TODO: Never accept nil as a benchmarked input
-;; TODO: Guarantee that it always returns a list of non-empty lists. (Non-empty
-;; meaning each does contain members of ITEMS). Easier to reason about
-;; mistakes in the code later.
+;; TODO: Write some tests (make a fake table)
(defun el-job--split-optimally (items n table)
"Split ITEMS into up to N lists of items.
@@ -195,34 +194,35 @@ being saddled with a mega-item in addition to the average
workload."
(if (> dur max-per-core)
;; Dedicate huge items to their own cores
(push (list item) sublists)
+ ;; Grow a sublist unless it would hit the max
(if (< dur (- max-per-core this-sublist-sum))
(progn
(push item this-sublist)
(setq this-sublist-sum (+ this-sublist-sum dur)))
- ;; This sublist hit time limit, so it's done.
+ ;; This sublist hit max, so it's done.
;; Next iteration will begin a new sublist (or throw).
(push this-sublist sublists)
(setq this-sublist-sum 0)
(setq this-sublist nil)
(push item items)))))))
- ;; If last sublist did not hit time limit, let it absorb any
- ;; remaining items. (Sloppy, but benchmarks should make it
- ;; moot for next time.)
+ ;; If last sublist did not hit the max, let it absorb any remaining
+ ;; items. (Sloppy as there could be a lot in special cases, but
+ ;; benchmarks should make it moot for next time.)
(if this-sublist
(push (nconc untimed items this-sublist) sublists)
;; Last sublist already hit time limit, spread leftovers equally
(let ((ctr 0)
(len (length sublists)))
(if (= len 0)
- (unless (not (equal total-duration (time-convert 0 t)))
- (error "el-job: Unexpected code path, report appreciated!
Result: %S"
- (list 'max-per-core max-per-core
- 'this-sublist-sum this-sublist-sum
- 'n n
- 'untimed untimed
- 'items items
- 'sublists sublists
- 'this-sublist this-sublist)))
+ (error "el-job: Unexpected code path, report appreciated!
Data: %S"
+ (list 'n n
+ 'total-duration total-duration
+ 'max-per-core max-per-core
+ 'this-sublist-sum this-sublist-sum
+ 'untimed untimed
+ 'items items
+ 'sublists sublists
+ 'this-sublist this-sublist))
(dolist (item (nconc untimed items))
(push item (nth (% (cl-incf ctr) len)
sublists))))))
- [elpa] externals/el-job ffb216b52d 093/143: Don't record cores-to-use in struct, always use max, (continued)
- [elpa] externals/el-job ffb216b52d 093/143: Don't record cores-to-use in struct, always use max, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 73835a02a0 103/143: Try to be compatible with Emacs 28, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 006af3ffd4 104/143: DROP SUPPORT Emacs 28, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 455e198d47 111/143: CI, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job a70b492bf4 105/143: Release version 2.1.0, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 0b180cc276 112/143: Comments, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 58699f2328 116/143: Lint, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 99c31acdb3 131/143: Update outdated comments in el-job-child.el, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 68237f09c3 134/143: Follow elisp convention, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 268102c786 138/143: Oops, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 40f86f79fc 028/143: Clarifications,
ELPA Syncer <=
- [elpa] externals/el-job 252c669cd5 042/143: Move code around, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job aa435ef02b 047/143: Rename :wrapup to :callback, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job e14b325e2c 070/143: Fix oversights, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job b000549169 078/143: Readme, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job c85b4ca947 081/143: Readme, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job ecc8e55678 092/143: Release version 1.1.0, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 0e571484f9 095/143: Drop support for anonymous jobs, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 6f93dc82bd 121/143: Add obsolete internal alias to ease upgrade-in-running-Emacs, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 27cf46baf0 123/143: Hotfix, ELPA Syncer, 2025/03/22
- [elpa] externals/el-job 2704c7e3d9 126/143: Comments, ELPA Syncer, 2025/03/22