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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow performance when loading large JSONs and toggling collapse/expand #138

Open
gurupras opened this issue Sep 15, 2021 · 6 comments
Open

Comments

@gurupras
Copy link

I think the entire JSON tree is being re-rendered every time one item is toggled. This does not scale well for large JSONs.
Additionally, the component struggles to display a JSON of size ~21MB 馃檨

One thing I did notice was that most of the time is being spent in jsonFlatten and/or flatData computation. Is there anything we can do to improve both of these? Given that jsonFlatten is not touching the DOM in any way, can we parallelize the work using WebWorkers? I'm happy to work on implementing it, but I don't fully understand the codebase yet.

Branch: 1.x

json-load-performance.mp4
json-toggle-performance.mp4
@leezng
Copy link
Owner

leezng commented Sep 15, 2021

Have you turned on the virtual list mode?

@gurupras
Copy link
Author

Yes, sorry, I've configured it as follows:

 <vue-json-pretty :data="filteredData"
    ref="results"
    style="height: inherit; max-height: inherit;"
    :deep="expandDepth"
    :deep-collapse-children="true"
    :show-double-quotes="false"
    :virtual="true"
    :virtual-lines="100"
    :select-on-click-node="false"
    :highlight-selected-node="false"/>

@fredrivett
Copy link
Contributor

I'm also seeing something similar, some JSON loads are taking over 10 seconds and are blocking the rest of the UI from loading.

I've not looked into this but what are your thoughts on @gurupras investigation about jsonFlatten and/or flatData being the bottleneck @leezng? Intrigued if you have any ideas about what the issue might be and where we might be able to improve things here.

One option in my mind is if deep isn't infinity then to prioritise calculating the collapsed view, display that but read only and then swap it out to the interactive version once that has finished loading.

If we could find a way to increase efficiency that would be ideal.

@leezng
Copy link
Owner

leezng commented Sep 30, 2021

Sorry, I have been busy recently and did not reply in time. I found this problem. In the demo, when the array reaches 10,000, it took 5s to calculate. My thought is whether it is possible to use the ability on the worker to calculate it?

There is also a feature here, which is the number of rows of current data, so we have to ensure that we can calculate the number of each row of data.

@simake2017
Copy link

the same to me

@leezng
Copy link
Owner

leezng commented Aug 16, 2022

In the latest version(1.9.0 & 2.2.0), the efficiency of JSON parsing has been improved by 40 times compared with the previous version, maybe you can have a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants