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

Slow performance for large error values that ends up using typeErrorPreview() #122

Closed
wader opened this issue Aug 28, 2021 · 2 comments
Closed

Comments

@wader
Copy link
Contributor

wader commented Aug 28, 2021

Hi, i had a performance issue in a script that i tracked down to essentially this when . was an array including large number of values and nested objects.

.a? // false

using GOJQ_DEBUG=1 ... -tags debug (very useful) i could see that issue is probably that the huge value that fails being index:ed gets serialized by *expectedObjectError.Error() and doing a hack in gojq.typeErrorPreview it seems to conform it.

Here is a easy way to reproduce the issue:

go run cmd/gojq/main.go -n '[range(1000000)] | repeat(.a? // "a")'

I guess an improvement could be to somehow limit depth/array iteration in the preview function? or maybe the call to Error() can be deferred until it's actually is needed somehow?

@itchyny
Copy link
Owner

itchyny commented Aug 28, 2021

Fixed.

@wader
Copy link
Contributor Author

wader commented Aug 28, 2021

Thanks!

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

2 participants