unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Julian Scheid <julians37@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Fast JSON codec based on YAJL
Date: Tue, 15 Jan 2013 04:04:37 +0100	[thread overview]
Message-ID: <CAD1CDTVXPhaWPz5Zx4NeQPtd=pO+5He3FgeUQy=PX3K8dhTZqQ@mail.gmail.com> (raw)
In-Reply-To: <jwvzk0bnpws.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]

On Tue, Jan 15, 2013 at 3:26 AM, Stefan Monnier <monnier@iro.umontreal.ca>wrote:

> You mean that json.elc is only 5 to 25 times slower than
> a C implementation?  I actually expected significantly worse.
>

Both share quite a few code paths actually, for example number-to-string
conversion (and vice versa) and multibyte handling. I wrote the code a
little
while ago but IIRC data conversion between Emacs-land and native land
accounts
for a non-negligible share of the runtime, and of course the same goes for
building Emacs data structures from parsed data. (It doesn't help that with
JSON, you don't know how big an array or map will be until you're finished
parsing it.)

Also, although performance is my primary objective, I didn't pick the C
library
on that aspect alone. For example, libjson bills itself as a "JSON reader
and
writer which is super-effiecient [sic] and usually runs circles around other
JSON libraries." But it doesn't support streaming and thus would add a
significant memory overhead for large documents, and also it's not nearly as
portable.

I did spend some time making sure that the interface performs well and
there are
no obvious low-hanging-fruit-type optimizations left, but any help with
making
it even faster is welcome! I think that an order of magnitude is a good
start
though, it certainly takes my other app from "painfully slow" to "perfectly
usable".

[-- Attachment #2: Type: text/html, Size: 2638 bytes --]

      reply	other threads:[~2013-01-15  3:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15  0:36 Fast JSON codec based on YAJL Julian Scheid
2013-01-15  2:26 ` Stefan Monnier
2013-01-15  3:04   ` Julian Scheid [this message]

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='CAD1CDTVXPhaWPz5Zx4NeQPtd=pO+5He3FgeUQy=PX3K8dhTZqQ@mail.gmail.com' \
    --to=julians37@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).