From: "Simen Heggestøyl" <simenheg@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 21798@debbugs.gnu.org
Subject: bug#21798: 25.0.50; [PATCH] Add support for retrieving paths to JSON elements
Date: Mon, 02 Nov 2015 00:27:46 +0100 [thread overview]
Message-ID: <1446420466.13180.0@smtp.gmail.com> (raw)
In-Reply-To: <1446407553.4906.0@smtp.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2242 bytes --]
Hello again, Dmitry.
I managed to produce a benchmark with the following JSON file (560K,
~10,000 lines): http://folk.uio.no/simenheg/huge.json.
I read it into `huge-json', and ran the following before the patch:
(benchmark-run 100 (json-read-from-string huge-json))
⇒ (19.421527195 938 7.448190372000017)
And after the patch:
(benchmark-run 100 (json-read-from-string huge-json))
⇒ (19.321667537 997 7.218977015999971)
-- Simen
On Sun, Nov 1, 2015 at 8:52 PM, Simen Heggestøyl <simenheg@gmail.com>
wrote:
> Hi Dmitry, thanks for the feedback!
>
> On Sat, Oct 31, 2015 at 3:23 PM, Dmitry Gutov <dgutov@yandex.ru>
> wrote:
>> The video looks great, but the inline patch lacks indentation, and
>> doesn't apply (dunno if the former is the cause of the latter).
>> Please resend it as an attachment.
>
> Ah, yes, it appear that the whitespace got lost in the email for some
> reason. I'll try attaching it to this email.
>
> To test it, I've been using the following interactive function:
>
> (defun json-mode-show-path ()
> "Show the path to the JSON value under point."
> (interactive)
> (let ((path (json-path-to-position (point))))
> (if path
> (let ((formatted-path
> (json-mode--format-path (plist-get path :path))))
> (pulse-momentary-highlight-region
> (plist-get path :match-start)
> (plist-get path :match-end))
> (message formatted-path)
> (kill-new formatted-path))
> (message "Not a JSON value"))))
>
> (defun json-mode--format-path (path)
> "Return PATH formatted as a JSON data selector.
> PATH should be a list of keys, which can be either strings or
> integers."
> (mapconcat (lambda (key) (format "[%S]" key)) path ""))
>
> It's also included it in json-mode.el:
> http://folk.uio.no/simenheg/json-mode.el.
>
>> Without trying it, my main concern would be any performance
>> regression to json-read (it's not particularly fast already). Have
>> you done any benchmarking?
>
> I agree that would be bad. I'll try to produce some benchmarks when
> I've got some free time on my hands!
>
> -- Simen
[-- Attachment #2: Type: text/html, Size: 3377 bytes --]
next prev parent reply other threads:[~2015-11-01 23:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-31 8:46 bug#21798: 25.0.50; [PATCH] Add support for retrieving paths to JSON elements Simen Heggestøyl
2015-10-31 14:23 ` Dmitry Gutov
2015-11-01 19:52 ` Simen Heggestøyl
2015-11-01 23:27 ` Simen Heggestøyl [this message]
2015-11-03 2:00 ` Dmitry Gutov
2015-11-06 16:31 ` Simen Heggestøyl
2015-11-06 17:15 ` Dmitry Gutov
2015-11-07 13:23 ` Richard Stallman
2015-11-07 13:43 ` Dmitry Gutov
2015-11-07 18:50 ` Simen Heggestøyl
2015-11-07 19:18 ` Dmitry Gutov
2015-11-08 12:32 ` Simen Heggestøyl
2015-11-08 12:34 ` Simen Heggestøyl
2015-11-08 16:16 ` Dmitry Gutov
2015-11-08 21:12 ` Simen Heggestøyl
2015-11-09 0:20 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446420466.13180.0@smtp.gmail.com \
--to=simenheg@gmail.com \
--cc=21798@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.