[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20154: 25.0.50; json-encode-string is too slow for large strings
From: |
Eli Zaretskii |
Subject: |
bug#20154: 25.0.50; json-encode-string is too slow for large strings |
Date: |
Sun, 22 Mar 2015 18:50:05 +0200 |
> Date: Sun, 22 Mar 2015 16:52:03 +0200
> From: Dmitry Gutov <dgutov@yandex.ru>
> CC: 20154@debbugs.gnu.org
>
> (defun json-encode-string-3 (string)
> "Return a JSON representation of STRING."
> ;; Reimplement the meat of `replace-regexp-in-string', for
> ;; performance (bug#20154).
> (let ((l (length string))
> (start 0)
> (res (list "\"")))
> ;; Skip over ASCIIish printable characters.
> (while (string-match "[\"\\/\b\f\n\r\t]\\|[^ -~]" string start)
> (let* ((mb (match-beginning 0))
> (c (aref string mb))
> (special (rassoc c json-special-chars)))
Did you try a 'cond' with specific characters instead of calling
rassoc every time? The list in json-special-chars is not long, is it?
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, (continued)
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Ivan Shmakov, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Ivan Shmakov, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Glenn Morris, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings,
Eli Zaretskii <=
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/22
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/23