From: Dmitry Gutov <dgutov@yandex.ru>
To: "Basil L. Contovounesios" <contovob@tcd.ie>, 46761@debbugs.gnu.org
Subject: bug#46761: 28.0.50; Speed up json.el encoding
Date: Sat, 27 Feb 2021 20:51:05 +0200 [thread overview]
Message-ID: <06140794-3f40-8a35-573d-4414d2611afc@yandex.ru> (raw)
In-Reply-To: <87a6rtszgk.fsf@tcd.ie>
On 25.02.2021 03:33, Basil L. Contovounesios wrote:
> Severity: wishlist
> Tags: patch
>
> The attached patch speeds up json-encode by inserting into a buffer
> rather than concatenating strings. It does so backward compatibly by
> creating a new json--print-* namespace that mirrors the existing
> json-encode-* namespace, cleaning it up a bit and reducing code
> duplication in the process.
>
> Using my usual benchmark from bug#40693#89:
>
> canada.json
> old (1.412693239 96 0.736882091)
> new (1.154423962 32 0.248241551)
>
> citm_catalog.json
> old (0.676292855 68 0.5285956769999993)
> new (0.306573098 12 0.0965493740000003)
>
> twitter.json
> old (0.353447016 40 0.28536439900000055)
> new (0.142140227 8 0.05943713899999992)
>
> Note that one of the unit tests depends on the patch to map.el in
> bug#46754 in order to pass.
Looking good.
I'm guessing there is an approximate size where structures smaller than
that size will get slower to encode because of this change (creating a
temp buffer and switching to it are not entirely free), but I can't
think of a use case where this would matter.
next prev parent reply other threads:[~2021-02-27 18:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-25 1:33 bug#46761: 28.0.50; Speed up json.el encoding Basil L. Contovounesios
2021-02-25 18:21 ` Basil L. Contovounesios
2021-02-25 19:36 ` Basil L. Contovounesios
2021-03-06 18:37 ` Basil L. Contovounesios
2021-02-27 18:51 ` Dmitry Gutov [this message]
2021-02-27 19:30 ` Basil L. Contovounesios
2021-02-27 20:01 ` Dmitry Gutov
2021-02-27 21:09 ` Basil L. Contovounesios
2021-02-27 21:10 ` Dmitry Gutov
2021-02-27 21:16 ` Basil L. Contovounesios
2021-02-27 21:21 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06140794-3f40-8a35-573d-4414d2611afc@yandex.ru \
--to=dgutov@yandex.ru \
--cc=46761@debbugs.gnu.org \
--cc=contovob@tcd.ie \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).