Subject: bug#46761: 28.0.50; Speed up json.el encoding

From: "Basil L. Contovounesios" <[email-masked]>
Date: Thu, 25 Feb 2021 19:36:14 +0000

"Basil L. Contovounesios" <[email-masked]> writes:

> @@ -458,9 +460,9 @@ json-read-string
>  (defun json--print-string (string &optional from)
>    "Insert a JSON representation of STRING at point.
>  FROM is the index of STRING to start from and defaults to 0."
> -  (goto-char (prog1 (1+ (point))
> -               ;; Strip `read-only' property (bug#43549).
> -               (insert ?\" (substring-no-properties string from))))
> +  (goto-char (prog1 (1+ (point)) (insert ?\" string)))
> +  (set-text-properties (point) (point-max) ())
> +  (and from (delete-char from))

AKA:

  (insert ?\")
  (goto-char (prog1 (point) (princ string)))
  (and from (delete-char from))

-- 
Basil