aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2015-12-28 18:47:51 +0100
committerLars Ingebrigtsen2015-12-28 18:47:51 +0100
commit91ef47353d423acbeeace443984f0ac097f1b2a0 (patch)
tree826441064856694b20490755252694ed46ebd489
parent1f11b33a780ca4adeff7560cf347ea41cd31bc43 (diff)
downloademacs-91ef47353d423acbeeace443984f0ac097f1b2a0.tar.gz
emacs-91ef47353d423acbeeace443984f0ac097f1b2a0.zip
IDNA speed up
* puny.el (puny-encode-domain): Make the common non-IDNA case faster
-rw-r--r--lisp/net/puny.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index 5874871a90d..389a6dc2700 100644
--- a/lisp/net/puny.el
+++ b/lisp/net/puny.el
@@ -32,7 +32,11 @@
32(defun puny-encode-domain (domain) 32(defun puny-encode-domain (domain)
33 "Encode DOMAIN according to the IDNA/punycode algorith. 33 "Encode DOMAIN according to the IDNA/punycode algorith.
34For instance, \"fśf.org\" => \"xn--ff-2sa.org\"." 34For instance, \"fśf.org\" => \"xn--ff-2sa.org\"."
35 (mapconcat 'puny-encode-string (split-string domain "[.]") ".")) 35 ;; The vast majority of domain names are not IDNA domain names, so
36 ;; add a check first to avoid doing unnecessary work.
37 (if (string-match "\\'[[:ascii:]]*\\'" domain)
38 domain
39 (mapconcat 'puny-encode-string (split-string domain "[.]") ".")))
36 40
37(defun puny-encode-string (string) 41(defun puny-encode-string (string)
38 "Encode STRING according to the IDNA/punycode algorithm. 42 "Encode STRING according to the IDNA/punycode algorithm.