GetMany could be more efficient?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 15.6k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
I'll preface by saying it's a hunch and I have no convincing argument other than my intuition and I'm not familiar with the internals of gjson.
For large JSON's GetMany will iterate through all the entire JSON and will be no more efficient than just calling Get, many, times.
I think there could be some point for optimiziation by checking if the path matches EITHER of the many paths provided.
i.e.
msg := `{
"message": "a hugeee lot of data",
"a": "b",
"c": "d",
"e": "f"
}`
// GetMany will iterate through the GIANT message and stop at "a",
// then do the same thing for "e", maybe this second pass could be skipped?
results := gjson.GetMany(msg, "a", "e");
Any thoughts?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names GetMany and repeated Get calls as the comparison point; start by reading those entry points and the relevant gjson internals. Establish whether multiple paths can be handled more efficiently while preserving returned values, then verify the result with performance comparisons and behavior checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100