WIP: perf(router): avoid calling set when the generated data unmodified#5482
WIP: perf(router): avoid calling set when the generated data unmodified#5482yoshinorin wants to merge 3 commits intomasterfrom
set when the generated data unmodified#5482Conversation
How to testgit clone -b perf/router-refresh https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test |
|
Now green. Use unique files for each test for watch. Because using the same files ( |
Pull Request Test Coverage Report for Build 8870147837Details
💛 - Coveralls |
set when the generated data unmodifiedset when the generated data unmodified
| } | ||
|
|
||
| it('watch() - source', async () => await testWatch(hexo.source_dir)); | ||
| it('watch() - source', async () => await testWatch(hexo.source_dir, 'source.test.watch.txt')); |
There was a problem hiding this comment.
I changed it to use unique files for each test for watch. Because using the same files (test.txt) as other tests caused failures. Perhaps caused by caching or something similar, but I'm not sure.
set when the generated data unmodifiedset when the generated data unmodified
|
I've noticed that when |
It seems that the |
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore |
There was a problem hiding this comment.
Always prefer // @ts-expect-error, do not use // @ts-ignore
What does it do?
When any file is modified, even unchanged routes are updated (the
setmethod is called). Additionally, in thesetmethod, EventEmitter's emit is called. So, events to be fired many times (number of assets) whenever a single file is updated.Maybe, it should be fine to call the
setmethod only for the modified files.Screenshots
N/A
Pull request tasks