-
Notifications
You must be signed in to change notification settings - Fork 96
Fixes #149 by adding a 30-pass limit to recursion... #276
base: master
Are you sure you want to change the base?
Conversation
…d stopping immediately on loops.
MarshallOfSound
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general seems like a good thing, just some performance / optimization things
src/compiler-host.js
Outdated
| * @private | ||
| */ | ||
| async compileUncached(filePath, hashInfo, compiler) { | ||
| async compileUncached(filePath, hashInfo, compiler, history=[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this slightly faster we should just use a Set instead of an array
src/compiler-host.js
Outdated
| // Got something we can use in-browser, let's return it | ||
| return Object.assign(result, {dependentFiles}); | ||
| } else if (history.indexOf(result.code) !== -1) { | ||
| d(`Compiler loop, I have seen this source before: ${JSON.stringify(result)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't log the compiler result, that's a lot of info to pipe to stdout
src/compiler-host.js
Outdated
| d(`Compiler loop, I have seen this source before: ${JSON.stringify(result)}`); | ||
| return Object.assign(result, {dependentFiles}); | ||
| } else if (history.length > 30) { | ||
| d(`Runaway compilation: ${JSON.stringify({history: history, result: result})}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, piping a lot of stuff to stdout actually takes a long time
|
Better? |
... and stopping immediately on loops.
In order to support
passthrough, on loops we still return whatever the dependent file was, even though we "cannot use it". Anything else would make the term "passthrough" very strange for what we're doing there. But this might not be a sane default for other compilers which get stuck in self-reference loops.