diff options
author | mlang <mlang> | 2007-02-21 14:05:00 +0000 |
---|---|---|
committer | mlang <mwolson@gnu.org> | 2007-02-21 14:05:00 +0000 |
commit | 0a2a9b02e30a9d9755102a07a41cac8bddccdab9 (patch) | |
tree | f22332bbd4182f30f0a729cf5b0edc5e29db4d45 | |
parent | c042491950f6b57ff1c14d6bfd9d4f01a72d5d4a (diff) |
Speed up emms-play-directory-tree by about factor 10
Most of the speedup comes from using nconc in later-do instead
of append (and therefore, not excessively copying lists).
I see a factor of 10 speedup when generating the playlist
for 37000 audio files.
darcs-hash:20070221140553-08870-162cb94182e5e4947a0972a67b9229db8899e7cd.gz
-rw-r--r-- | emms-source-file.el | 16 | ||||
-rw-r--r-- | emms.el | 4 | ||||
-rw-r--r-- | later-do.el | 2 |
3 files changed, 12 insertions, 10 deletions
diff --git a/emms-source-file.el b/emms-source-file.el index 5384f4a..79bbfc7 100644 --- a/emms-source-file.el +++ b/emms-source-file.el @@ -135,13 +135,15 @@ value of `emms-source-file-default-directory'." emms-source-file-default-directory emms-source-file-default-directory t))) - (mapc (lambda (file) - (unless (let ((case-fold-search nil)) - (string-match emms-source-file-exclude-regexp file)) - (emms-playlist-insert-track - (emms-track 'file file)))) - (emms-source-file-directory-tree (expand-file-name dir) - (emms-source-file-regex)))) + (let ((files (emms-source-file-directory-tree (expand-file-name dir) + (emms-source-file-regex))) + (case-fold-search nil)) + (emms-playlist-ensure-playlist-buffer) + (mapc (lambda (file) + (unless (string-match emms-source-file-exclude-regexp file) + (funcall emms-playlist-insert-track-function + (emms-track 'file file)))) + files))) ;;;###autoload (autoload 'emms-play-find "emms-source-file" nil t) ;;;###autoload (autoload 'emms-add-find "emms-source-file" nil t) @@ -1344,11 +1344,11 @@ or negative to seek backwards." ;; This is a simple helper data structure, used by both players ;; and tracks. -(defun emms-dictionary (name) +(defsubst emms-dictionary (name) "Create a new dictionary of type NAME." (list name)) -(defun emms-dictionary-type (dict) +(defsubst emms-dictionary-type (dict) "Return the type of the dictionary DICT." (car dict)) diff --git a/later-do.el b/later-do.el index 6c98da0..8c04c1d 100644 --- a/later-do.el +++ b/later-do.el @@ -52,7 +52,7 @@ time after this call, and definitely not while lisp is still executing. Code added using `later-do' is guaranteed to be executed in the sequence it was added." - (setq later-do-list (append later-do-list + (setq later-do-list (nconc later-do-list (list (cons function args)))) (unless later-do-timer (setq later-do-timer |