scalar icon indicating copy to clipboard operation
scalar copied to clipboard

Performance issues when YAML consists of ~200k LoC

Open ad-on-is opened this issue 1 year ago β€’ 6 comments

What happens?

I'm the developer of AdonisJS AutoSwagger

I just did some testing on a former project that I used to work on. The yaml of the project produces ~200k LoC (11MB) πŸ˜„ and compared the loading times of scalar to rapidoc and the default Swagger-UI.

Scalar: 10 seconds Swagger-UI/rapidoc: ~ 1-2 seconds

Even the sandbox crashes, so I cannot post the example unfortunately

What did you expect to happen?

Load the UI within 1-2 seconds.

How can we reproduce the issue?

Try to get a 200k LoC yaml

Swagger/OpenAPI Example

No response

ad-on-is avatar Apr 22 '24 15:04 ad-on-is

THANKS for sharing! We’ll look into this. Any chance you can share the file with us? [email protected]

hanspagel avatar Apr 22 '24 15:04 hanspagel

https://adisdurakovic.com/scalar-big.yml

I replaced some model names with Disney characters, to not give out too much real data.

ad-on-is avatar Apr 22 '24 18:04 ad-on-is

Running into browser tab crashes/hanging when testing with an openapi.json with about ~30K LOC.

In the past with other editors and viewers, this was easily solved/performance drastically improved by rendering tag sections in their own view/page, rather than all on a single view/page. Are there any plans to potentially have a mode for scalar where you could configure that?

Right now, with ~30K LOC, the initial load isn't as big of an issue, but when I select a specific endpoint and it auto-opens the entire models section, is where it goes downhill very fast.

lrstanley avatar Aug 17 '24 18:08 lrstanley

Is that still the case with the latest version? Would be great if you could give it a try.

And is your OpenAPI document public? So great to have more real-world examples.

hanspagel avatar Sep 10 '24 16:09 hanspagel

Testing 1.25.10 and the particular spec with an issue (now about 49K LOC), it has better performance on initial load, however hitting the Test Request button for one of our endpoints causes the browser to say the tab hung, and if I leave it for about 60 seconds, the popup to test the request finally renders. I'll see if I can get an obfuscated version for you.

Update:

Spec URL, some of which has been truncated, but I think it still has the necessary amount of info: https://cdn.liam.sh/misc/examples/openapi-truncated-scalar.json

Example page using 1.25.10, linking to an example endpoint -- if you hit Test Request, you will notice performance issues: https://cdn.liam.sh/misc/examples/scalar-performance.html#tag/identities/GET/identities

Video also showing this -- this is my high-end personal desktop (16 cores and 64GB of RAM), so it's not terrible, but you'll notice the animation latency when hovering over items on the side, in addition to the delay with test request:

https://cdn.liam.sh/share/2024/09/zen_mspDGu1fr7.mp4

In our work environment, on lower performance laptops, virtual desktops, etc, the performance is terrible (60s+, tab crashing, etc).

lrstanley avatar Sep 10 '24 22:09 lrstanley

Awesome, thanks for sharing this! We should be able to improve this.

hanspagel avatar Sep 12 '24 09:09 hanspagel

Hi, is there any progress on this issue? I am using this file for testing: https://github.com/github/rest-api-description/blob/main/descriptions/api.github.com/api.github.com.yaml, and I have encountered a similar problem πŸ€”. Thanks.

LiteSun avatar Oct 11 '24 00:10 LiteSun

We definitely improved the performance (just yesterday) and it works fine on my machine now. πŸ‘Œ Definitely room for improvement, but we’re getting there.

Would you mind to check with the latest version?

hanspagel avatar Oct 11 '24 11:10 hanspagel

Thank you so much for the update and the improvements! πŸ™ I’ll try it out with the latest version and will provide feedback after testing it thoroughly.

LiteSun avatar Oct 12 '24 08:10 LiteSun