feat: add virtualization (configurable) #2623
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What/Why/How?
Projects with very large APIs often experience significant lag and frequent crashes when using Redoc. To address this issue, virtualization has been introduced. Virtualization allows elements to be rendered only when they are near the user's viewport, significantly reducing memory consumption for very large API documentation.
Virtualization is made optional because not every project would benefit from enabling it by default. It is advantageous only when the data is large, as it introduces an additional overhead of calculating the virtualization. When the data is not substantial, the drawbacks of this overhead outweigh the benefits.
Benchmark result
Using edge profiler, each recorded in 20 seconds in an OpenAPI docs with 192,076 (190K+) lines
Reference
Closes #2615
Tests
Introduced extra unit tests. Results of running all the tests:
Screenshots (optional)
Kapture.2024-11-26.at.14.21.22.mp4
Check yourself