From: plugd Date: Fri, 30 Jul 2021 22:20:49 +0000 (+0200) Subject: Speed up rendering of large gemini pages. X-Git-Tag: v3.2.0~9^2~1 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=47c18669b665691fad2a9277d1002259852bf77f;p=elpher.git Speed up rendering of large gemini pages. --- diff --git a/ISSUES.org b/ISSUES.org index cf082d1..9923820 100644 --- a/ISSUES.org +++ b/ISSUES.org @@ -260,3 +260,20 @@ collapsable hierarchies. :LOGBOOK: - State "CLOSED" from "OPEN" [2021-07-23 Fri 10:09] :END: + +** CLOSED Improve gemeini rendering speed +:LOGBOOK: +- State "CLOSED" from "OPEN" [2021-07-31 Sat 00:18] +:END: + +Currently pages with many links render extremely slowly. + +Example (>2000 links, 15s): gemini://rawtext.club/~sloum/geminilist/ + +It turns out that by far the main contributor to this is the use of +(url-port) in elpher-address-from-gemini-url. I encountered this +problem once before in elpher-remove-redundant-ports. This function +call is just incredibly slow for some bizarre reason. Happily, +(url-portspec) is functionally equivalent and is orders of magnitude +faster. With this replacement, loading the above page takes ~2s +and there aren't any other hotspots. diff --git a/elpher.el b/elpher.el index 0391d21..5197cb2 100644 --- a/elpher.el +++ b/elpher.el @@ -1454,7 +1454,7 @@ treatment that a separate function is warranted." (if (string-empty-p (url-filename address)) (setf (url-filename address) "/")) ;ensure empty filename is marked as absolute (setf (url-host address) (url-host current-address)) - (setf (url-port address) (url-port current-address)) + (setf (url-portspec address) (url-portspec current-address)) ; (url-port) too slow! (unless (string-prefix-p "/" (url-filename address)) ;deal with relative links (setf (url-filename address) (concat (file-name-directory (url-filename current-address))