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

Improve stream rendering performances #641

Open
wants to merge 10 commits into
base: 1.11.x
Choose a base branch
from
Open

Improve stream rendering performances #641

wants to merge 10 commits into from

Conversation

satabin
Copy link
Member

@satabin satabin commented Oct 24, 2024

This change addresses #634 in two ways:

  • A change to the generic pretty printer that allows to avoid:
    • Boxing of integers when computing the layout
    • Instantiating many tuples that are immediately discarded
    • Creating intermediate chunks by fusing the annotation and rendering phases
  • Re-introduce a direct compact rendering for JSON, that is way simpler than leveraging the generic printer with no groups

By doing so, the compact rendering should be back to the performance in 1.10 and the pretty case is improved a bit.

Here are some benchmark results with the compact rendering in 1.11.1 as the baseline. 1.11.2 represents the results with this change.

xychart-beta
  title "Rendering of int array"
  x-axis ["Pretty 1.10", "Pretty 1.11.1", "Pretty 1.11.2", "Compact 1.11.1", "Compact 1.11.2"]
  y-axis "Factor" 0 --> 1.2
  bar [0.02, 1.12, 0.71, 1, 0.004]
Loading
xychart-beta
  title "Rendering of int object"
  x-axis ["Pretty 1.10", "Pretty 1.11.1", "Pretty 1.11.2", "Compact 1.11.1", "Compact 1.11.2"]
  y-axis "Factor" 0 --> 1.2
  bar [0.01, 1.11, 0.85, 1, 0.01]
Loading

@satabin satabin requested a review from a team as a code owner October 24, 2024 09:30
@satabin satabin added enhancement New feature or request json regression labels Oct 24, 2024
@satabin
Copy link
Member Author

satabin commented Oct 24, 2024

@recons This PR should solve your problem with compact rendering once merged and released.

@satabin satabin force-pushed the json/render branch 3 times, most recently from 2829f8f to a0c50b0 Compare October 24, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request json regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant