You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been thinking of prototyping this feature, as well. If I get some free
time over the next couple days I may look at your code and spin something
off of it for an actual PR.
Activity
nieksand commentedon Jul 20, 2016
Correction.. only supports 63 keys given signed int64 the way bitwiseFlags is populated.
buger commentedon Jul 20, 2016
Yes it is, I have few ideas how to fix it without sacrificing performance.
On Wednesday, 20 July 2016, Niek Sanders notifications@github.com wrote:
Sincerely yours Leonid Bugaev
http://gortool.com - test your system with real data
nieksand commentedon Jul 21, 2016
First off, thank you for writing and sharing this library! It's been incredibly helpful for a little project I'm working on.
A wishlist item that relates to the many key lookup issue...
I wish there was a way to iterate over a map and just have a callback invoked for each key/value pair:
For a many-key scenario like mine, I can just lookup the key in a Go map to see if it's interesting to me.
Similarly, if you just want to chomp through all the keys in the map, this avoids having to determine/specify the keys you care about up front.
nieksand commentedon Jul 21, 2016
I did a super-trashy hack implementation of my wishlist item above.
Before I invoked EachKey ~3 times per json payload to pull my data. (63 keys per call).
Now I use "WalkMap" once.
Overall performance of my app, which includes many things unrelated to json, went from 20K msgs/sec to 30k msgs/sec.
Before I was cpu-bound on json processing. Now I have free cpu and am bottlenecked elsewhere in my app.
Like I mentioned, the code is hacked garbage hence no PR.
But if you are curious it sits here: https://github.com/nieksand/jsonparser/blob/master/parser.go#L334
The actual change is here:
https://github.com/nieksand/jsonparser/blob/master/parser.go#L365
daboyuka commentedon Jul 21, 2016
I've been thinking of prototyping this feature, as well. If I get some free
time over the next couple days I may look at your code and spin something
off of it for an actual PR.
On Jul 21, 2016 01:08, "Niek Sanders" notifications@github.com wrote:
nieksand commentedon Jul 21, 2016
Very cool.
I'm thinking it might be possible to rewrite EachKey to run on top of WalkMap. That would avoid the code duplication issue.
v1.4.0: ArrayEachErr, Escape/SetString, wildcards, JSONPath, GetArray…
buger commentedon Jul 28, 2026
Fixed in v1.4.0 — EachKey now handles paths with >64 key components without panicking (falls back to heap allocation when the stack array is exceeded). See: https://github.com/buger/jsonparser/releases/tag/v1.4.0