Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to concurrently run many queries on a single JSON object #236

Open
samsullivan opened this issue Jan 14, 2024 · 0 comments
Open

Comments

@samsullivan
Copy link

gojq/query.go

Lines 22 to 23 in 111b6ef

// It is safe to call this method in goroutines, to reuse a parsed [*Query].
// But for arguments, do not give values sharing same data between goroutines.

In addition to this preventing reusing JSON data in gojq queries across goroutines, it also becomes an unnecessary performance hit for the use case of executing multiple different queries against the same JSON data. Maybe not a common use case, but it is the whole reason I began using gojq (see https://github.com/samsullivan/jqless for the use case).


The main culprit is that any numeric values in the JSON data interface need to be normalized: https://github.com/itchyny/gojq/blob/main/normalize.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant