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

Generate objects lazily & remove itertools dependency #119

Merged
merged 1 commit into from
Oct 27, 2023
Merged

Conversation

01mf02
Copy link
Owner

@01mf02 01mf02 commented Oct 27, 2023

This PR makes evaluation of object keys/values lazy.

Previously, the following filter would never yield a single result:

'{("a", "b"): (0 | recurse(.+1)), ("c", "d"): 2}'

Now, it generates an infinite stream of objects, just like jq.

How's performance? Let's test it with the following filter:

limit(1000000; {("a", "b"): (0 | recurse(.+1)), ("c", "d"): 2}) | empty

jq 1.7 takes 1.1 seconds, whereas jaq takes only 0.5 seconds! :)

As a bonus, this also eliminates the dependency of jaq-interpret on itertools.

@01mf02 01mf02 merged commit 81b1af0 into main Oct 27, 2023
1 check passed
@01mf02 01mf02 deleted the lazy-object branch October 27, 2023 10:24
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

Successfully merging this pull request may close these issues.

1 participant