[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: |
Fri, 20 Mar 2015 19:44:37 +0200 |
> Date: Fri, 20 Mar 2015 18:52:26 +0200
> From: Dmitry Gutov <dgutov@yandex.ru>
> CC: 20154@debbugs.gnu.org
>
> On 03/20/2015 06:44 PM, Eli Zaretskii wrote:
>
> > To see how much of the time is taken by json-encode-char, replace it
> > with something trivial, like 1+, and see what speedup you get.
>
> Yep. Replacing the second definition with
>
> (defun json-encode-big-string (str)
> (with-temp-buffer
> (insert str)
> (goto-char (point-min))
> (while (re-search-forward "[\"\\/\b\f\b\r\t]\\|[^ -~]" nil t)
> (replace-match "z" t t))
> (format "\"%s\"" (buffer-string))))
>
> still makes it take ~100ms on the example string (as opposed to 2ms in
> the optimized Python implementation).
That's not what I see here. I cannot get the time above 1 sec even
with a 1000 time longer input string, if I replace json-encode-char
with 1+.
So I think your 100ms is the constant overhead of some kind.
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/20
- 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/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/20
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/21
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/21
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/21
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Eli Zaretskii, 2015/03/21
- bug#20154: 25.0.50; json-encode-string is too slow for large strings, Dmitry Gutov, 2015/03/21
- 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, Dmitry Gutov, 2015/03/22