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

Improving perfomance for JSON Lines format #41

Merged
merged 2 commits into from May 12, 2024
Merged

Conversation

edy555
Copy link
Contributor

@edy555 edy555 commented Apr 30, 2024

This patch improves performance when loading JSON Lines format.

Loading JSON Lines cause significant slowdown and stop accepting keys, even if the length is moderate.
This situation can be reproduced like follows.

seq 10000 |  jq -cs '{"id":.[]}' | jnv

For visualization and suggestions, the entire long list is not necessary, but a partial list of some length is enough.
Therefore I have created simple patch.

  • Give a limit length for arrays as loading JSON Lines format
  • Add --limit-length option to be able to specify the length

I often deal with JSON-Lines files that have tens of thousands of lines, so I hope jnv can handle them comfortably.

@edy555 edy555 changed the title Improving perfomance on JSON Lines format Improving perfomance of JSON Lines format May 1, 2024
@edy555 edy555 changed the title Improving perfomance of JSON Lines format Improving perfomance for JSON Lines format May 1, 2024
src/jnv.rs Outdated Show resolved Hide resolved
@ynqa
Copy link
Owner

ynqa commented May 4, 2024

@edy555 Thank you. I've put a comment.

src/main.rs Show resolved Hide resolved
@ynqa
Copy link
Owner

ynqa commented May 11, 2024

@edy555 Sorry for my responses late... Commented about the short flag -s. Everything else LGTM.

[edited] Never mind this one, detailed at #41 (comment)

Copy link
Owner

@ynqa ynqa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ynqa ynqa merged commit f42ff8a into ynqa:main May 12, 2024
6 checks passed
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.

None yet

2 participants