nolanlawson / rollupify

Browserify transform to apply Rollup (UNMAINTAINED)
Apache License 2.0
386 stars 16 forks source link

feat: cache rollup's bundle to massively speed-up watchify bundles #16

Closed dariocravero closed 8 years ago

dariocravero commented 8 years ago

Simple change, huuuge impact :)

Random numbers from a project I'm working on now:

Before this:

# cold load
651137 bytes written (4.87 seconds)

# subsequent bundles
651270 bytes written (2.55 seconds)

After the patch:

# cold load
651137 bytes written (4.87 seconds)

# subsequent bundles
651270 bytes written (0.53 seconds)

It's like 5 times faster already :)

dariocravero commented 8 years ago

Hey @nolanlawson, I don't know if it's possible to get access to npm for this package but if it is I'm happy to push updates with changes like this one or for instance rollup updating versions, etc. :)

nolanlawson commented 8 years ago

So I can't find any documentation on cache in Rollup (e.g. on this page) - can you confirm that it does indeed do a per-module cache, so e.g. if you have multiple bundles, they won't overwrite each other?

As for access to the npm package, yeah I'm happy to make you a contributor and a publisher, but it's still good to get +1s from someone else. :) Typically in my projects I do 1) make a PR, 2) wait for +1, 3) if no response after 24 hours, timebomb and merge it anyway. Cheers!

dariocravero commented 8 years ago

That sounds like a good way to go about it :); I'm dario@uxtemple.com on npm. As for cache, yeah, it's a pity it's not documented :) So far, rollup takes only the modules from the cache. I'm not sure I'm following with multiple bundles, could you elaborate on that? Do you mean multiple targets?

dariocravero commented 8 years ago

(btw, just added some docs around it :P https://github.com/rollup/rollup/wiki/JavaScript-API, let's hope my assumptions are alright!)

nolanlawson commented 8 years ago

Yes, I meant multiple targets. Thanks for the fix to the wiki; makes sense to me. I'll add you as a committer and publisher and publish this as a patch release; cheers!