itchyny / gojq

Pure Go implementation of jq
MIT License
3.26k stars 118 forks source link

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

Open samsullivan opened 8 months ago

samsullivan commented 8 months ago

https://github.com/itchyny/gojq/blob/111b6efe91ed9356ad160d7c4822a897ec9ccb39/query.go#L22-L23

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