emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 91ef473 1/2: IDNA speed up


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 91ef473 1/2: IDNA speed up
Date: Mon, 28 Dec 2015 18:14:00 +0000

branch: master
commit 91ef47353d423acbeeace443984f0ac097f1b2a0
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    IDNA speed up
    
    * puny.el (puny-encode-domain): Make the common non-IDNA case faster
---
 lisp/net/puny.el |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index 5874871..389a6dc 100644
--- a/lisp/net/puny.el
+++ b/lisp/net/puny.el
@@ -32,7 +32,11 @@
 (defun puny-encode-domain (domain)
   "Encode DOMAIN according to the IDNA/punycode algorith.
 For instance, \"fśf.org\" => \"xn--ff-2sa.org\"."
-  (mapconcat 'puny-encode-string (split-string domain "[.]") "."))
+  ;; The vast majority of domain names are not IDNA domain names, so
+  ;; add a check first to avoid doing unnecessary work.
+  (if (string-match "\\'[[:ascii:]]*\\'" domain)
+      domain
+    (mapconcat 'puny-encode-string (split-string domain "[.]") ".")))
 
 (defun puny-encode-string (string)
   "Encode STRING according to the IDNA/punycode algorithm.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]