broccolijs / broccoli

Browser compilation library – an asset pipeline for applications that run in the browser
https://broccoli.build
MIT License
3.33k stars 216 forks source link

Dropping the cleanup callback, and whether to handle SIGINT #263

Open joliss opened 9 years ago

joliss commented 9 years ago

Currently, the main use case for the cleanup callback is deleting temporary directories (example). With the upcoming new API, tmp dir handling will be centralized, so this will no longer be necessary.

I'm wondering if we can drop cleanup from the API. We can still resurrect it later if necessary, thanks to the versioned (feature-flagged) API scheme.

Thinking about use cases for cleanup, the following come to mind:

So I think it might be OK to drop cleanup. Are there other use cases for cleanup that I'm missing?

[1] We don't have first-class support for persistent caches at the moment, but we might add this in the future.


The motivation for dropping cleanup is that I'd like to avoid having a piece of API that is essentially unused.

Another reason why I'd like to get rid of cleanup is that handling SIGINT (Ctrl+C) is tricky. This is perhaps only a semi-related issue, but I still wanted to bring it up:

timmfin commented 9 years ago

I'm glad to move my persistent cache work from cleanup to something per rebuild. But it really should be done after the rebuild had finished and not inline/synchronous with the current rebuild.

I'm already getting to the point where my builds are getting "slow", even in the ideal, nothing-has-changed case. This is because—in projects with thousands of files—the cost of merely walking over, stat-ing, and re-symlink-ing all of the files in an input tree is becoming significant. For one plugin/filter, that cost isn't too bad (maybe ~100ms IIRC) but when you have several filters composed together, things add up. So adding more per-rebuild/per-filter cost (the persistent data dumping) worries me.

And I assume that a new "post every rebuild" hook would have the same issues as cleanup does? (And you'd similarly be less interested to add that hook? :frowning:)

ps: FYI, to help alleviate these incremental build issues with large projects, I've tried implementing other various optimizations:

Update: I haven't been using Broccoli for over a year, so please don't worry as much about my previous work/efforts.