aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilij Schneidermann <mail@vasilij.de>2024-08-25 15:07:27 +0200
committerVasilij Schneidermann <mail@vasilij.de>2024-08-25 15:07:27 +0200
commit13ba2fe401c1ebc786317e5eca3cc06bddbf8cbd (patch)
treecc21f2980fad4ac10165dbd4d469ec35991c536a
parent32ded63420134d9995426910c5f5d9f5bd29fff8 (diff)
Improve NXC TOC rendering performance
For some reason, the entity encoding helper from xml.el is about 10x as slow as the one from url-util.el. On a particularly complicated NCX file, this dropped rendering times from 3.9s to 1.1s...
-rw-r--r--nov.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/nov.el b/nov.el
index 3fe78b6..7476b7e 100644
--- a/nov.el
+++ b/nov.el
@@ -50,7 +50,7 @@
(require 'seq)
(require 'shr)
(require 'url-parse)
-(require 'xml)
+(require 'url-util)
(require 'bookmark)
(require 'easymenu)
@@ -406,8 +406,8 @@ Each alist item consists of the identifier and full path."
(when (not href)
(error "Navigation point is missing href attribute"))
(let ((link (format "<a href=\"%s\">%s</a>"
- (xml-escape-string href)
- (xml-escape-string (or label href)))))
+ (url-insert-entities-in-string href)
+ (url-insert-entities-in-string (or label href)))))
(if children
(progn
(insert (format "<li>\n%s\n<ol>\n" link))