Subject: RE: bug#20154: 25.0.50; json-encode-string is too slow for large strings

From: Drew Adams <[email-masked]>
Date: Sat, 21 Mar 2015 14:05:55 -0700 (PDT)

> > I think the latest tendency is the opposite: move to Lisp everything
> > that doesn't need to be in C.
> 
> Yes, and often that's great, if we're dealing with some piece of UI
> infrastructure that only gets called at most a few times per command,
> with inputs of size we can anticipate in advance.

(FYI, I'm not following this thread.)  I will just say that if you want
or need to have something like `json-encode-string' be coded in C for
speed, an alternative might be for the actual code to invoke a Lisp
function when bound to a variable, e.g., `json-encode-string-function'.

That is, it can be OK to define something like the default encoding
of JSON in C, but perhaps you can give users the possibility of
optionally providing their own encoding Lisp function as well.  What
would, I think, be too bad would be to make it impossible or difficult
for users to provide their own encoding function (without messing with
C and rebuilding Emacs).