Is this with or without the patch I sent?
It is with the patch (in the two profiler.el reports, the "kill" hooks are not present)
> 1. The hooks are not called initially, I am not sure what triggers them. This makes the json parsing extremely
> slow(100 times)
The hooks are not called when decoding strings uses a fixed working
buffer that is created once and never killed. Then something in your
setup causes this single working buffer to become in-use, and Emacs
then allocates an additional buffer, which is created and killed each
time we need to decode a string. Both creating and killing of that
buffer runs the buffer-list-update-hook.
Just found that it is not my setup which triggers the issue bug pressing C-g during the parsing:
To reproduce:
(benchmark-run 10 (json-parse-string json-string))
(benchmark-run 10000000 (json-parse-string json-string))
(benchmark-run 10 (json-parse-string json-string))
Press C-g when second benchmark-run is processed.
> 2. Even without the hooks, the JSON parsing is slower than the emacs -q native parsing when I am running
> my setup. This will require additional investigation.
Please, let's first finish fixing the factors we do understand already
and see what effect that produces. Otherwise I don't see how we can
make steady progress in this matter. That is why I sent an initial,
most probably incomplete patch. Please apply it and see what it fixes
and what it doesn't fix.
I did exactly what you are saying here: I applied the patch and listed the effects:
1. The buffer-list-update-hook is called
2. The patch does not affect the perf difference between emacs -q and my setup.
> I must rely on you in this matter, because I cannot reproduce the
> slowdown on my system.
I realize that and I am trying to be as helpful as possible by sharing all my observations.
Thanks,
Ivan