-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
builtin.jq: simpler and faster transpose #2758
Conversation
It turns out that using max/0 is faster than using a stream-oriented version of max
Previously |
For backward-compatibility. Add check in jq.test
src/builtin.jq
Outdated
| reduce range(0; $max) as $j | ||
([]; . + [reduce range(0;$length) as $i ([]; . + [ $in[$i][$j] ] )] ) | ||
end; | ||
# Using map(length) turns out to be faster than using max(stream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still unsure about the stream version of max to be included or not. Users not following the history will be get confused by this comment; where is max(stream)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itchyny - Here, max(stream) is simply short for any valid streaming version of max. That should be clear since no specific referent is mentioned. Feel free to change the wording, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just drop the sentence, we don't need such performance notes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Done in a20c6d5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
It turns out that using max/0 is faster than using a stream-oriented version of max