pure180 / gulp-pug-inheritance

Gulp plugin to rebuild jade files and all files that have extended or included those files
11 stars 7 forks source link

Persisted inheritance tree? #3

Open daankets opened 7 years ago

daankets commented 7 years ago

Currently, my plain pug build (just compile everything) takes 17 seconds. Running the pug inheritance task takes 50 seconds, the total build takes more than a minute. So, the plugin is slowing down the build more than it is speeding up the build. I think there would be more value in this plugin if it would persist (cache) the inheritance tree, and re-use it during builds (re-evaluating changed files whenever possible).

pure180 commented 7 years ago

This is not a problem of this plugin itself, it is a problem of pug-inheritance and we are aware about this. We are talking about that in this issue.

Currently I'm working on a version that will use cache, that version is still beta and at the time it is using a temporary file to cache the inheritance tree. But further i'll implement a regular persist cache. Please try it and let me know if there are any bugs somehow. You can find the installtion instructions in issue: #2

pure180 commented 7 years ago

Btw, if you want to test the temporary cache file in the current beta, you have to set the default option saveInTempFile: false to saveInTempFile: true. Readme.md#Defaults

daankets commented 7 years ago

I’m already testing it ;-). I’m creating a .pugInheritance.json file in my build dir…

On 12 Mar 2017, at 17:21, Daniel Pfisterer notifications@github.com wrote:

Btw, if you want to test the temporary cache file in the current beta, you have to set the default option saveInTempFile: false to saveInTempFile: true. Readme.md#Defaults https://github.com/pure180/gulp-pug-inheritance/tree/1.0.0%40beta1#user-content-options--defaults — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pure180/gulp-pug-inheritance/issues/3#issuecomment-285951563, or mute the thread https://github.com/notifications/unsubscribe-auth/ACLKMR-D8kr9V_l4b-37PtpzoR0Xn835ks5rlA1igaJpZM4MajOF.

-- Disclaimer This message is confidential and only intended for the originally intended recipient(s). It may also be privileged or otherwise protected by work product immunity or other legal rules. If you think you have received this message by mistake, please let us know by e-mail reply and delete it from your system; you must not copy this message or disclose its contents to anyone other than the intended recipients.

daankets commented 7 years ago

Yes, it's working fine! A 78 second build just got reduced to 1.56 sec!

daankets commented 7 years ago

When does the plugin decide to re-discover inheritance? Upon a full (uncached) build?

pure180 commented 7 years ago

The plugin checks if it's running for the first time by resolving the existence of the cached object, for now the temporary json file (Line 129). If it doesn't exist it will create the cache. On the upcoming streams it compares the dependencies (includes and excludes) from the existing cache against the current dependencies (Line 82 -94). If they changed the plugin re-discovers the inheritance and rebuilds the cached object (Line 151 - 156).