Skip to content

perf(nuxt): use granular watcher to avoid crawling ignored dirs#20836

Merged
danielroe merged 13 commits intomainfrom
perf/many-watchers
May 18, 2023
Merged

perf(nuxt): use granular watcher to avoid crawling ignored dirs#20836
danielroe merged 13 commits intomainfrom
perf/many-watchers

Conversation

@danielroe
Copy link
Copy Markdown
Member

@danielroe danielroe commented May 13, 2023

🔗 Linked issue

#12376

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This follows up previous focus on watcher improvements (#20179) as a hybrid solution using chokidar - it filters out/ignores child directories within srcDir directly. In tests in the monorepo, it reduces chokdar startup on a M1 Mac by 50%. I would expect even more significant performance improvements on a windows machine.

To enable this you'll need to set experimental.watcher to granular. (Otherwise behaviour will stay the same as currently.)

I'd appreciate review - my main concern is whether we ought to make provision for users deliberately seeking to watch changes in .nuxt or node_modules (which they have enabled with a negative glob pattern in ignore).

cc: @stafyniaksacha

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe requested review from atinux and pi0 May 13, 2023 19:39
@danielroe danielroe self-assigned this May 13, 2023
@danielroe danielroe marked this pull request as draft May 13, 2023 19:56
@danielroe danielroe marked this pull request as ready for review May 13, 2023 20:29
@danielroe
Copy link
Copy Markdown
Member Author

/trigger release

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Release triggered! You can now install nuxt@npm:nuxt3@pr-20836

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

🚀 Release triggered! You can now install nuxt@npm:nuxt3@pr-20836

@danielroe danielroe added the 🧷 edge release This PR will be released via the edge channel. label May 16, 2023
@danielroe
Copy link
Copy Markdown
Member Author

/trigger release

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Release triggered! You can now install nuxt@npm:nuxt3@pr-20836

Copy link
Copy Markdown
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing idea! Love the approach!

@danielroe danielroe changed the title perf(nuxt): create granular watchers to avoid parsing entire file tree perf(nuxt): use granular watcher to avoid crawling ignored dirs May 18, 2023
@danielroe danielroe merged commit 9dea9bc into main May 18, 2023
@danielroe danielroe deleted the perf/many-watchers branch May 18, 2023 13:44
This was referenced May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x bug 🧷 edge release This PR will be released via the edge channel. 🔨 p3-minor performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants