[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb efd9e15 12/21: Provide an alternate threaded versi
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb efd9e15 12/21: Provide an alternate threaded version of ebdb-initialize |
Date: |
Sun, 17 Sep 2017 15:32:47 -0400 (EDT) |
branch: externals/ebdb
commit efd9e1512e00e4d93cfbed157f9c03164ebe76ac
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Provide an alternate threaded version of ebdb-initialize
Ref #53
* ebdb.el (ebdb-initialize): New function that calls thread-yield
every 10 records. This won't do anything at all by default.
(ebdb-load): Use the function if threading is available.
---
ebdb.el | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index 7db7cb2..accdcad 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4933,7 +4933,9 @@ important work is done by the `ebdb-db-load' method."
;; We're migrating from a version of BBDB.
(ebdb-migrate-from-bbdb))
(message "Initializing EBDB records...")
- (ebdb-initialize)
+ (if (fboundp 'make-thread)
+ (ebdb-initialize-threadwise)
+ (ebdb-initialize))
(message "Initializing EBDB records... done")
;; Users will expect the same ordering as `ebdb-sources'
(setq ebdb-db-list (nreverse ebdb-db-list))
@@ -4958,12 +4960,27 @@ important work is done by the `ebdb-db-load' method."
;; is searched.
(defun ebdb-initialize (&optional records)
"After all databases are loaded, initialize the records.
-
This results in the creation of all the secondary data
structures: label lists, `ebdb-org-hashtable', record caches,
etc."
(mapcar #'ebdb-init-record (or records ebdb-record-tracker)))
+(defun ebdb-initialize-threadwise (&optional records)
+ "Exactly the same as `ebdb-initialize', but yields thread.
+If Emacs has threading, then `ebdb-load' will call this function
+in its own thread, and the thread will be yielded after every ten
+record initializations. Note that by itself this will have no
+impact whatsoever on EBDB load times. It's up to the user to
+interleave it with other thread-yielding operations to create an
+actual speedup."
+ (let ((c 0))
+ (mapcar
+ (lambda (r)
+ (ebdb-init-record r)
+ (when (= (mod (cl-incf c) 10) 0)
+ (thread-yield)))
+ (or records ebdb-record-tracker))))
+
(defun ebdb-address-continental-p (address)
"Return non-nil if ADDRESS is a continental address.
This is done by comparing the postcode to `ebdb-continental-postcode-regexp'.
- [elpa] externals/ebdb 3a918eb 09/21: Provide better instructions for BBDB migration, (continued)
- [elpa] externals/ebdb 3a918eb 09/21: Provide better instructions for BBDB migration, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb cbb4cc1 20/21: More complete error handling for field insertion, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb c298037 21/21: Bump version for 0.3.2, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb 18be9ad 04/21: Add ebdb-field-bank-account class, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb dc5d03e 01/21: Change behavior of ebdb-fmt-compose-field, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb 9c0947c 05/21: Comment out some custom definitions for address field, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb 4a332dc 03/21: Add defgeneric for ebdb-read, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb 767a9fa 07/21: Allow two kinds of searches on tags, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb 8fc7b6d 08/21: Allow "fast lookups", Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb e3229ad 11/21: Give some indication that the migration process is ongoing, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb efd9e15 12/21: Provide an alternate threaded version of ebdb-initialize,
Eric Abrahamsen <=
- [elpa] externals/ebdb 2fa4379 14/21: New option ebdb-try-speedups, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb 09a04b2 19/21: Fix up ebdb-string method for bank accounts, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb 2b52686 18/21: Check type spec of slots that may or may not accept an object, Eric Abrahamsen, 2017/09/17
- [elpa] externals/ebdb b3266e5 17/21: Apparently when-let will be obsoleted by when-let*, Eric Abrahamsen, 2017/09/17