From: yyoncho <yyoncho@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "Sébastien Chapuis" <sebastien@chapu.is>, 31138@debbugs.gnu.org
Subject: bug#31138: Native json slower than json.el
Date: Sat, 23 Mar 2019 15:31:39 +0200 [thread overview]
Message-ID: <CACCVLQXMTtWPg2AZmLKvG83JkSxLR_S4==nx1Fov2oxj1vpVfw@mail.gmail.com> (raw)
In-Reply-To: <83lg15pvzr.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 4377 bytes --]
Hi Eli,
Take a look at the following piece of code:
https://gist.github.com/yyoncho/9e9c4e14734fdd9a22d6600a88a27ae1
(with the latest emacs compiled from master)
Unfortunately, I wasn't unable to reproduce the behaviour with "emacs -q"
and even it does not reproduce right after I load my emacs configuration
but after doing some navigation/coding. I believe that native parsing is
calling some function list defined in the elisp space but I am unable to
track down this. Please, let me know what I can do to help to diagnose this
issue.
Thanks,
Ivan
On Sat, Mar 23, 2019 at 3:21 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Sébastien Chapuis <sebastien@chapu.is>
> > Date: Sat, 23 Mar 2019 20:59:46 +0800
> > Cc: Ivan Yonchovski <yyoncho@gmail.com>, 31138@debbugs.gnu.org
> >
> > Sorry for not being clear, my main concern was the difference when
> > wrapping json-parse-string with with-temp-buffer or not.
>
> Ah, okay. I thought the concern was with the native JSON support
> being slower than json.el.
>
> > You are right, I tested with the current master branch and it is
> > faster (emacs -Q):
> >
> > (with-current-buffer "large.json"
> > (benchmark-run 10 (json-parse-string (buffer-string))))
> > ;;; (1.45898128 10 0.15294547200000003)
> >
> > (with-current-buffer "large.json"
> > (let ((str (buffer-string)))
> > (benchmark-run 10 (with-temp-buffer (json-parse-string str)))))
> > ;;; (0.706171416 10 0.18795709700000002)
> >
> > (with-current-buffer "large.json"
> > (let ((str (buffer-string)))
> > (benchmark-run 10 (with-temp-buffer (json-read-from-string str)))))
> > ;;; (2.476727624 138 1.5660531400000006)
>
> OK, this is consistent with what I see: about 3- to 4-fold speedup
> from using the native JSON support.
>
> > I have tested to read the file literally, as you suggested and there
> > is now no difference with or without with-temp-buffer (emacs -Q):
> >
> > (with-current-buffer (find-file-noselect "large.json" nil t)
> > (benchmark-run 10 (json-parse-string (buffer-string))))
> > ;;; (0.7011264119999999 10 0.118889765)
> >
> > (with-current-buffer (find-file-noselect "large.json" nil t)
> > (let ((str (buffer-string)))
> > (benchmark-run 10 (with-temp-buffer (json-parse-string str)))))
> > ;;; (0.7159130309999999 10 0.15112133999999997)
>
> I didn't mean find-file-noselect, I meant find-file-literally. Which
> one did you use in your testing?
>
> > For the context, with lsp-mode, we have users complaining about
> > performance of json-parse-string [1].
> > Some have found out that the function is way faster with emacs -Q but
> > it is "dead slow" with their Spacemacs setup.
> >
> > In lsp-mode, we are reading child process output by calling
> > `make-process` with `:coding 'no-conversion`, I think it has the same
> > behavior than reading a file "literally" ?
>
> Yes.
>
> > Is there anything else we could do to improve the performance from
> > reading the process output ?
>
> I don't know yet, let's first try to solve the issue below:
>
> > Now the problem is how can we have the same performance with a regular
> > emacs setup than with emacs -Q ?
> > With my emacs setup, I have this result:
> >
> > (with-current-buffer (find-file-noselect "large.json" nil t)
> > (benchmark-run 10 (json-parse-string (buffer-string))))
> > ;;; (1.515018996 10 0.5256668049999996)
> >
> > (with-current-buffer (find-file-noselect "large.json" nil t)
> > (let ((str (buffer-string)))
> > (benchmark-run 10 (with-temp-buffer (json-parse-string str)))))
> > ;;; (1.156755376 10 0.5596599300000001)
> >
> > This is almost 2x slower than with emacs -Q.
> > Note that there is still a difference with and without
> `with-temp-buffer`.
> > What can we do to reach emacs -Q performance ?
>
> I think the only sure way is to find the customization(s) which are
> responsible for the slowdown. First, use find-file-literally, and if
> that doesn't help, bisect your customizations to find which one(s)
> cause this two-fold slowdown.
>
> Once you identify the customizations responsible for the slowdown, we
> could then try to figure out whether that is due to some bugs or not,
> and if the latter, then how to avoid the slowdown even with those
> customizations in effect.
>
> Thanks.
>
[-- Attachment #2: Type: text/html, Size: 5571 bytes --]
next prev parent reply other threads:[~2019-03-23 13:31 UTC|newest]
Thread overview: 161+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 19:13 bug#31138: Native json slower than json.el Sebastien Chapuis
2018-04-13 7:24 ` Eli Zaretskii
2018-04-15 14:40 ` Sebastien Chapuis
2018-04-15 15:19 ` Eli Zaretskii
2019-03-23 1:59 ` Sébastien Chapuis
2019-03-23 8:15 ` Eli Zaretskii
2019-03-23 9:40 ` Eli Zaretskii
2019-03-23 12:59 ` Sébastien Chapuis
2019-03-23 13:21 ` Eli Zaretskii
2019-03-23 13:31 ` yyoncho [this message]
2019-03-23 14:00 ` Eli Zaretskii
2019-03-23 14:32 ` yyoncho
2019-03-23 14:55 ` Eli Zaretskii
2019-03-23 15:27 ` yyoncho
2019-03-23 16:29 ` Eli Zaretskii
[not found] ` <CACCVLQW=_YngoTwXU+1BDvVVy5jwxSmDFUQJBvs8=PrP=fn=aw@mail.gmail.com>
2019-03-23 18:50 ` Eli Zaretskii
2019-03-23 20:23 ` yyoncho
2019-03-23 20:54 ` Eli Zaretskii
2019-03-23 21:04 ` yyoncho
2019-03-24 3:32 ` Eli Zaretskii
2019-03-24 9:35 ` yyoncho
2019-03-24 11:20 ` Eli Zaretskii
2019-03-24 11:37 ` yyoncho
2019-03-24 15:15 ` Eli Zaretskii
2019-03-24 18:24 ` yyoncho
2019-03-24 18:28 ` Eli Zaretskii
2019-03-24 20:57 ` yyoncho
2019-03-25 3:32 ` Eli Zaretskii
2019-03-25 5:44 ` yyoncho
2019-03-25 16:42 ` Eli Zaretskii
2019-03-25 18:20 ` yyoncho
2019-03-25 18:25 ` Eli Zaretskii
2019-03-25 19:16 ` yyoncho
2019-03-25 20:05 ` Eli Zaretskii
2019-03-25 21:34 ` yyoncho
2019-03-25 23:04 ` Dmitry Gutov
2019-03-26 3:51 ` Eli Zaretskii
2019-03-26 16:14 ` Eli Zaretskii
2019-03-26 17:45 ` yyoncho
2019-03-26 18:11 ` Eli Zaretskii
2019-03-26 18:15 ` yyoncho
2019-04-16 1:36 ` Dmitry Gutov
2019-04-16 2:38 ` Eli Zaretskii
2019-04-16 13:50 ` Dmitry Gutov
2019-04-16 15:13 ` Eli Zaretskii
2019-04-16 15:30 ` Dmitry Gutov
2019-04-16 16:10 ` Eli Zaretskii
2019-04-16 16:23 ` Dmitry Gutov
2019-04-16 16:44 ` Eli Zaretskii
2019-04-21 8:58 ` Eli Zaretskii
2019-04-21 9:15 ` Dmitry Gutov
2019-04-21 9:31 ` Eli Zaretskii
2019-04-21 10:23 ` yyoncho
2019-04-21 10:37 ` Eli Zaretskii
2019-04-21 11:38 ` yyoncho
2019-04-21 12:15 ` Eli Zaretskii
2019-04-21 13:28 ` yyoncho
2019-04-21 19:03 ` Eli Zaretskii
2019-04-21 20:13 ` Eli Zaretskii
2019-04-22 5:38 ` yyoncho
2019-04-22 8:01 ` Eli Zaretskii
2019-04-22 13:00 ` yyoncho
2019-04-22 13:17 ` Eli Zaretskii
2019-04-22 16:53 ` Ivan
2019-04-22 16:58 ` Eli Zaretskii
2019-04-21 22:17 ` Dmitry Gutov
2019-04-22 7:16 ` Eli Zaretskii
2019-04-22 13:54 ` Dmitry Gutov
2019-04-22 15:24 ` Eli Zaretskii
2019-04-22 15:31 ` Dmitry Gutov
2019-04-21 12:59 ` Philipp Stephani
2019-04-21 13:09 ` yyoncho
2019-04-21 13:33 ` Philipp Stephani
2019-04-22 11:48 ` Dmitry Gutov
2019-04-22 12:12 ` Eli Zaretskii
2019-04-22 12:24 ` Dmitry Gutov
2019-04-22 13:02 ` Eli Zaretskii
2019-04-22 15:02 ` Dmitry Gutov
2019-04-22 15:36 ` Eli Zaretskii
2019-04-22 16:16 ` Dmitry Gutov
2019-04-22 16:28 ` Eli Zaretskii
2019-04-22 16:44 ` Dmitry Gutov
2019-04-22 16:50 ` Eli Zaretskii
2019-04-22 17:05 ` Dmitry Gutov
2019-04-22 17:24 ` Eli Zaretskii
2019-04-22 21:03 ` Dmitry Gutov
2019-04-23 10:22 ` Eli Zaretskii
2019-04-23 11:39 ` Dmitry Gutov
2019-04-23 13:19 ` Eli Zaretskii
2019-04-22 16:49 ` Eli Zaretskii
2019-04-22 17:11 ` Dmitry Gutov
2019-04-22 17:26 ` Eli Zaretskii
2019-04-22 22:23 ` Dmitry Gutov
2019-04-23 6:00 ` Eli Zaretskii
2019-04-23 9:46 ` Philipp Stephani
2019-04-23 10:38 ` Eli Zaretskii
2019-04-23 10:44 ` Dmitry Gutov
2019-04-24 2:23 ` Richard Stallman
2019-04-22 17:12 ` Eli Zaretskii
2019-04-22 21:00 ` Dmitry Gutov
2019-04-21 22:14 ` Dmitry Gutov
2019-04-22 7:06 ` Eli Zaretskii
2019-04-21 22:12 ` Dmitry Gutov
2019-04-22 7:03 ` Eli Zaretskii
2019-04-22 11:46 ` Dmitry Gutov
2019-04-22 12:07 ` Eli Zaretskii
2019-04-22 12:58 ` Dmitry Gutov
2019-04-22 13:12 ` Eli Zaretskii
2019-04-22 13:58 ` Dmitry Gutov
2019-04-22 15:25 ` Eli Zaretskii
2019-04-22 15:41 ` Dmitry Gutov
2019-04-22 15:50 ` Eli Zaretskii
2019-04-22 16:00 ` Dmitry Gutov
2019-04-22 16:22 ` Eli Zaretskii
2019-04-22 19:55 ` Dmitry Gutov
2019-04-22 20:28 ` Eli Zaretskii
2019-04-23 11:52 ` Dmitry Gutov
2019-04-23 12:15 ` Eli Zaretskii
2019-04-23 12:37 ` yyoncho
2019-04-23 13:09 ` Eli Zaretskii
2019-04-23 13:27 ` yyoncho
2019-04-23 14:24 ` Eli Zaretskii
2019-04-23 12:37 ` Sébastien Chapuis
2019-04-23 13:10 ` Eli Zaretskii
2019-04-23 14:22 ` Dmitry Gutov
2019-04-23 14:40 ` Philipp Stephani
2019-04-23 15:09 ` Eli Zaretskii
2019-04-23 15:17 ` Eli Zaretskii
2019-04-23 15:36 ` yyoncho
2019-04-23 15:39 ` Eli Zaretskii
2019-04-23 15:43 ` yyoncho
2019-04-23 22:34 ` Dmitry Gutov
2019-04-24 6:20 ` Eli Zaretskii
2019-04-24 6:57 ` Dmitry Gutov
2019-04-24 7:28 ` Eli Zaretskii
2019-04-24 9:52 ` Dmitry Gutov
2019-04-23 14:58 ` Eli Zaretskii
2019-04-24 15:55 ` Dmitry Gutov
2019-04-24 16:21 ` Eli Zaretskii
2019-04-24 16:46 ` Dmitry Gutov
2019-04-24 17:06 ` Eli Zaretskii
2019-04-24 17:36 ` Dmitry Gutov
2019-04-24 17:43 ` Eli Zaretskii
2019-04-24 20:25 ` Dmitry Gutov
2019-04-25 10:44 ` Eli Zaretskii
2019-04-25 14:27 ` Dmitry Gutov
2020-08-22 23:28 ` Lars Ingebrigtsen
2020-08-23 5:50 ` Eli Zaretskii
2019-04-23 14:50 ` Andy Moreton
2019-04-23 15:03 ` Eli Zaretskii
2019-04-23 15:44 ` Andy Moreton
2019-04-22 11:36 ` Dmitry Gutov
2019-04-22 12:01 ` Eli Zaretskii
2019-04-22 13:11 ` Dmitry Gutov
2019-03-30 9:07 ` Eli Zaretskii
2019-04-22 18:20 ` Alex Gramiak
2019-04-22 18:27 ` Eli Zaretskii
2019-04-22 19:52 ` Alex Gramiak
2019-04-22 20:05 ` Dmitry Gutov
2019-04-23 3:06 ` Alex Gramiak
2019-04-23 11:44 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACCVLQXMTtWPg2AZmLKvG83JkSxLR_S4==nx1Fov2oxj1vpVfw@mail.gmail.com' \
--to=yyoncho@gmail.com \
--cc=31138@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=sebastien@chapu.is \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.