-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat(source-nodes): optimize node sourcing and transformation for improved performance #703
feat(source-nodes): optimize node sourcing and transformation for improved performance #703
Conversation
…roved performance - Implement concurrent fetching of pages using Promise.all to speed up data retrieval. - Refactor variable names for better readability and maintainability. - Enhance node processing logic to handle content fields more efficiently. - Ensure robust handling of datasource entries and their dimensions. - Maintain support for local assets with improved caching mechanism. - Remove unused code. - Fix linting issues. - Update README.md.
@demirgazetic Thank you for creating a PR! Also, thank you for providing me with the details above. I wrote a few questions for review. Please feel free to comment there, as I have a few things I would like to hear more details about. You also removed the old code from As Gatsby users need to constantly pay attention to reducing the rate limit and performance cost, these opt-in options object provided by Gatsby looks like the way to go. Again, that's what we also did the same for the |
…ation logic - Updated the pagination logic to use a single `page` variable for both the initial response and the for loop. - Changed the calculation of `lastPage` by dividing the total number by 100 instead of 25 to optimize the page count.
🎉 This issue has been resolved in version 7.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Changes made:
Reason for the Change
Our goal was to enable incremental builds in our Gatsby using the official
gatsby-source-storyblok
plugin. During implementation, we noticed that thesource and transform nodes
step was significantly slow, leading us to reconsider using this plugin.After reviewing the source code of the Storyblok plugin, we identified several potential improvements. This pull request (PR) details the enhancements we've made.
Key Changes and Benefits
Sequential Fetching to Concurrent Fetching:
By implementing concurrent fetching, we observed a 20%-30% speed increase for large spaces with over 5000 pages and more than 20 datasources, some containing over 10,000 values.
Optimizing Datasource Fetching:
icons
are used internally in Storyblok, are not required on the frontend. By selectively fetching only the needed datasources, we further optimized performance.includeDatasources
: This option allows specifying which datasources to fetch, avoiding unnecessary data retrieval.Example configuration in
gatsby-config.js
:Implementation logic:
Fetching Tags
Since not everyone uses Storyblok Tags, having the option to disable this feature would also save time.
Summary
These changes result in significant performance improvements, making the plugin more suitable for large projects. By implementing concurrent fetching and selective datasource fetching, we have optimized the
source and transform nodes
step, making the Gatsby build process more efficient.