[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode 14e2e3b 105/346: Fix exponential fontification time
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode 14e2e3b 105/346: Fix exponential fontification time of backslashes in WYSIWYG-literals |
Date: |
Sun, 29 Aug 2021 11:00:12 -0400 (EDT) |
branch: elpa/d-mode
commit 14e2e3bf85cd9cb7db3e7d524a66cdbdccda2d91
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
Fix exponential fontification time of backslashes in WYSIWYG-literals
Fixes issue #64
Changes the regex introduced in #22 as follows:
- Move the first non-\ character set outside of the repeated group.
As there is an identical character set at the end of the repeated
group, this was redundant, and the main cause of the slowdown.
- Exclude the \ character from the character set excluding `.
This was also causing fontification to take an exponential time,
to a lesser degree.
- Use non-greedy matching, which should generally perform better than
greedy matching.
Test file included, though it only tests for fontification time,
not resulting syntax.
---
d-mode-test.el | 1 +
d-mode.el | 2 +-
tests/I0064.d | 5 +++++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/d-mode-test.el b/d-mode-test.el
index cb5fcfc..1347254 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -214,6 +214,7 @@
(ert-deftest d-mode-basic ()
(should (equal (do-one-test "tests/I0021.d") t))
(should (equal (do-one-test "tests/I0039.d") t))
+ (should (equal (do-one-test "tests/I0064.d") t))
)
;;----------------------------------------------------------------------------
diff --git a/d-mode.el b/d-mode.el
index e043237..ccf398b 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -542,7 +542,7 @@ Key bindings:
;; syntax-propertize-rules function for more information.
(when (version<= "24.3" emacs-version)
(setq-local syntax-propertize-function
- (syntax-propertize-rules ("`\\([^`]*\\(\\\\\\)[^`]*\\)+`" (2
"."))))))
+ (syntax-propertize-rules
("`[^\\\\`]*?\\(\\(\\\\\\)[^\\\\`]*?\\)+?`" (2 "."))))))
;;----------------------------------------------------------------------------
;; "Hideous hacks" to support appropriate font-lock behaviour.
diff --git a/tests/I0064.d b/tests/I0064.d
new file mode 100644
index 0000000..3457c13
--- /dev/null
+++ b/tests/I0064.d
@@ -0,0 +1,5 @@
+`\`aoeu
+`\\`aoeu
+
+`\\aaa\\aaa\\aaa\\aaa`
+`\\aaa\\aaa\\aaa\\aaa
- [nongnu] elpa/d-mode 02733b0 223/346: Remove some redundant progns, (continued)
- [nongnu] elpa/d-mode 02733b0 223/346: Remove some redundant progns, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode c9febb3 299/346: d-mode-test: Always ignore .res files, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 2d4bc7d 318/346: Update comments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 46a57f4 310/346: Fontify the special words inside version/debug/extern/pragma/__traits/scope, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 805eeba 078/346: Add links to build and coverage status to README., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8076559 081/346: Replace obsolete defadvice by the new advice-add., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode ee38763 083/346: Use the new advising mechanism on new emacs versions., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5c06e99 087/346: add d-exceptions compilation error regexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5501b77 096/346: Prepare for a formal release., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 89339fa 100/346: Fix typo in comment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 14e2e3b 105/346: Fix exponential fontification time of backslashes in WYSIWYG-literals,
ELPA Syncer <=
- [nongnu] elpa/d-mode 438cf53 109/346: fixed missing keyword "idouble", ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f6bf2b7 141/346: tests: Split test into individual ert tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 23d7a1a 148/346: tests: Fix testing compilation-mode buffers with Emacs 26, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a731ae6 157/346: Fix imenu for functions with parameter types containing parens, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode ab1057f 159/346: Fix imenu for functions with tail qualifiers on their own line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f61e72c 173/346: Drop support for Emacs < 24.3, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 09745ba 175/346: Merge pull request #87 from CyberShadow/emacs-24-plus, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode cfd1d08 180/346: Use rx-to-string instead of rx-form to support Emacs master (#97), ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode af6dbfa 183/346: Generalize StorageClass/VisibilityAttribute parsing in imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 2964263 184/346: Fix imenu with alias templates, ELPA Syncer, 2021/08/29