[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 4c67675437 032/182: add GC tuning information to READM
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 4c67675437 032/182: add GC tuning information to README |
Date: |
Tue, 13 Dec 2022 03:59:22 -0500 (EST) |
branch: elpa/flx
commit 4c67675437e9c2e338f091322bb967ba93f2d86d
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
add GC tuning information to README
---
README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/README.md b/README.md
index b6c1eeb3e5..f1b3e5bc26 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,61 @@ It's unlikely to crash your Emacs, but do expect to encounter
bugs.
[Screencast showing rationale and ido workflow][]
+# Memory Usage
+
+The flx algorithm willingly sacrifices memory usage for speed.
+
+For 10k file names, about 10 MB of memory will be used to speed up future
+matching. This memory is never released to keep the match speed fast.
+
+So far with modern computers, this feels like a reasonable design decision.
+
+It may change in future.
+
+
+# GC Optimization
+
+Emacs garbage collector is fairly primitive stop the world type. GC time can
+contribute significantly to the run-time of computation that allocates and
+frees a lot of memory.
+
+Consider:
+
+ (defun uuid ()
+ (format "%08x-%08x-%08x-%08x"
+ (random (expt 16 4))
+ (random (expt 16 4))
+ (random (expt 16 4))
+ (random (expt 16 4))))
+
+ (benchmark-run 1
+ (let ((cache (flx-make-filename-cache)))
+ (dolist (i (number-sequence 0 10000))
+ (flx-process-cache (uuid) cache))))
+ ;;; ⇒ (0.899678 9 0.33650300000000044)
+
+This means that roughly 30% of time is spent just doing garbage-collection.
+
+`flx` can benefit significantly from garbage collection tuning.
+
+By default Emacs will initiate GC every 0.76 MB allocated (`gc-cons-threshold`
+== 800000). If we increase this to 20 MB (`gc-cons-threshold` == 20000000)
+
+We get:
+
+ (benchmark-run 1
+ (setq gc-cons-threshold 20000000)
+ (let ((cache (flx-make-filename-cache)))
+ (dolist (i (number-sequence 0 10000))
+ (flx-process-cache (uuid) cache))))
+ ;;; ⇒ (0.62035 1 0.05461100000000041)
+
+So if you have a modern machine, I encourage you to add
+
+ (setq gc-cons-threshold 20000000)
+
+to your init file.
+
# ido support
Add this to your init file and *flx* match will be enabled for ido.
- [nongnu] elpa/flx f0c3157268 114/182: Increase default flx-ido-threshold to 6000, (continued)
- [nongnu] elpa/flx f0c3157268 114/182: Increase default flx-ido-threshold to 6000, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f5fda2897f 125/182: enable lexical-binding, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3cd3bf7687 129/182: add perf test-case, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 2b31df9ed0 140/182: Make dynamic programming test even more "difficult", ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx cd557fcb00 051/182: fix C-SPC, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9e7749e9e6 067/182: Merge pull request #27 from bbatsov/fix-capital-check, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 7424f54816 079/182: flx-ido: don't require cl; flx requires it anyway, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3bcaf03434 002/182: add readme, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx bdfd9d98aa 014/182: add travis status image, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 6189f05c7e 004/182: add flx, ido implementation and helm experiment, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 4c67675437 032/182: add GC tuning information to README,
ELPA Syncer <=
- [nongnu] elpa/flx 114cf369cb 020/182: add ido installation instructions, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 7452ab1c79 021/182: README update, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f566207c82 015/182: travis config update, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 01eef11b96 033/182: small efficiency fix, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 44951ac311 042/182: simplify caching, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx cc3258bb10 038/182: cache key should be based on whole input, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 771f61f3fd 016/182: update test list, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a792c2c5f1 053/182: change advice to before, fix comments, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 61dcc4f563 089/182: Reset caches on file reload., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 24f5d2cfc5 099/182: Fix typo threshhold -> threshold, ELPA Syncer, 2022/12/13