From 13ba2fe401c1ebc786317e5eca3cc06bddbf8cbd Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Sun, 25 Aug 2024 15:07:27 +0200 Subject: 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... --- nov.el | 6 +++--- 1 file 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 "%s" - (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 "
  • \n%s\n
      \n" link)) -- cgit v1.2.3