bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31138: Native json slower than json.el


From: yyoncho
Subject: bug#31138: Native json slower than json.el
Date: Sun, 24 Mar 2019 20:24:35 +0200

Hi Eli,

Before starting to test the patch I saw that Fget_buffer_create is running Qbuffer_list_update_hook - do we need to do a similar thing for it too?

Thanks,
Ivan

On Sun, Mar 24, 2019 at 5:15 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: yyoncho <yyoncho@gmail.com>
> Date: Sun, 24 Mar 2019 13:37:23 +0200
> Cc: Sébastien Chapuis <sebastien@chapu.is>,
>       31138@debbugs.gnu.org
>
> After code_convert_string_norecord the callstack is the same as the callstack of the JSON parsing (it uses
> the same method to convert/validate the string). 

Got it, thanks.

Please try the patch below and see if it solves the problem in both
cases.

diff --git a/src/coding.c b/src/coding.c
index 905c7ce..f9c9dc8 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7807,10 +7807,14 @@ make_conversion_work_buffer (bool multibyte)
   Lisp_Object name, workbuf;
   struct buffer *current;

+  current = current_buffer;
   if (reused_workbuf_in_use)
     {
       name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil);
       workbuf = Fget_buffer_create (name);
+      set_buffer_internal (XBUFFER (workbuf));
+      Fset (Fmake_local_variable (Qkill_buffer_query_functions), Qnil);
+      Fset (Fmake_local_variable (Qkill_buffer_hook), Qnil);
     }
   else
     {
@@ -7819,9 +7823,8 @@ make_conversion_work_buffer (bool multibyte)
        Vcode_conversion_reused_workbuf
          = Fget_buffer_create (Vcode_conversion_workbuf_name);
       workbuf = Vcode_conversion_reused_workbuf;
+      set_buffer_internal (XBUFFER (workbuf));
     }
-  current = current_buffer;
-  set_buffer_internal (XBUFFER (workbuf));
   /* We can't allow modification hooks to run in the work buffer.  For
      instance, directory_files_internal assumes that file decoding
      doesn't compile new regexps.  */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]