New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caching #31

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
@joscha
Copy link

joscha commented Apr 29, 2014

This adds caching to gulp-uglify.
We needed this because of the amount of JS files and delta compiling to speed up our dev environment.

@joscha

This comment has been minimized.

Copy link

joscha commented Apr 30, 2014

The speed increase is quite remarkable:

[gulp] Using gulpfile ~/jimdo/gulpfile.js
[gulp] Starting 'watch'...
[gulp] Finished 'watch' after 3.2 s
[gulp] function.bind.js was changed
[gulp] Starting 'shims.js'...
[gulp] Starting 'web.js'...
[gulp] Starting 'cms.js'...
[gulp] Starting 'new_cms_classes.js'...
[gulp] Starting 'siteadmin.js'...
[gulp] Starting 'mobile.js'...
[gulp] Finished 'shims.js' after 4.03 s
[gulp] Finished 'siteadmin.js' after 5.61 s
[gulp] Finished 'mobile.js' after 11 s
[gulp] Finished 'web.js' after 11 s
[gulp] Finished 'cms.js' after 13 s
[gulp] Finished 'new_cms_classes.js' after 14 s
[gulp] function.bind.js was changed
[gulp] Starting 'shims.js'...
[gulp] Starting 'web.js'...
[gulp] Starting 'cms.js'...
[gulp] Starting 'new_cms_classes.js'...
[gulp] Starting 'siteadmin.js'...
[gulp] Starting 'mobile.js'...
[gulp] Finished 'shims.js' after 318 ms
[gulp] Finished 'siteadmin.js' after 384 ms
[gulp] Finished 'web.js' after 574 ms
[gulp] Finished 'mobile.js' after 559 ms
[gulp] Finished 'cms.js' after 628 ms
[gulp] Finished 'new_cms_classes.js' after 668 ms

14s vs. 668 ms (e.g. factor 20)

@Xiphe

This comment has been minimized.

Copy link

Xiphe commented Apr 30, 2014

😍

@joscha

This comment has been minimized.

Copy link

joscha commented May 7, 2014

@terinjokes any thoughts on this?

@terinjokes

This comment has been minimized.

Copy link
Owner

terinjokes commented May 7, 2014

I didn't see the email from GitHub when you opened the PR. Sorry!

I'm in my phone now, but I quickly reviewed, and I'll likely take it with some clean up.

@joscha

This comment has been minimized.

Copy link

joscha commented May 7, 2014

@terinjokes Great! If there is anything you want me to clean up in specific, please let me know.

@terinjokes

This comment has been minimized.

Copy link
Owner

terinjokes commented May 7, 2014

@joscha nah, nothing you need to do. I just I have certain ways I like code organized. 😄

@terinjokes terinjokes referenced this pull request May 9, 2014

Closed

slow #29

@AndrewRayCode

This comment has been minimized.

Copy link

AndrewRayCode commented Jun 26, 2014

grunt-gulp is very slow, eta on when this will land?

@joscha

This comment has been minimized.

Copy link

joscha commented Jun 27, 2014

@terinjokes any way we can get this merged?

@forestbelton

This comment has been minimized.

Copy link

forestbelton commented Jun 30, 2014

we're in sore need of this merge as well! 😄

@terinjokes

This comment has been minimized.

Copy link
Owner

terinjokes commented Jun 30, 2014

I'm taking this into consideration for improvements for 1.0

@joscha

This comment has been minimized.

Copy link

joscha commented Jun 30, 2014

@terinjokes anything we can help with?

@ScottSmith95

This comment has been minimized.

Copy link

ScottSmith95 commented Aug 4, 2014

+1

1 similar comment
@rico

This comment has been minimized.

Copy link

rico commented Aug 12, 2014

+1

@joscha

This comment has been minimized.

Copy link

joscha commented Aug 12, 2014

@terinjokes any news on this?

@terinjokes

This comment has been minimized.

Copy link
Owner

terinjokes commented Aug 26, 2014

I believe this makes sense somewhere else. Has anyone tried any one of these plugins, and wishes to make a recommendation? https://github.com/gulpjs/gulp#incremental-builds

@terinjokes terinjokes closed this Aug 26, 2014

@joscha

This comment has been minimized.

Copy link

joscha commented Aug 26, 2014

They don't work the way the caching works inside the plugin, because they
work on the output.
Am 26.08.2014 04:33 schrieb "Terin Stock" notifications@github.com:

Closed #31 #31.


Reply to this email directly or view it on GitHub
#31 (comment).

@terinjokes

This comment has been minimized.

Copy link
Owner

terinjokes commented Aug 26, 2014

The top two I looked at pass forward the files if they've changed, which when paired with gulp-remember can be used as an effective replacement for the caching here, and works for all plugins, not just this one.

@Xiphe

This comment has been minimized.

Copy link

Xiphe commented Aug 26, 2014

I'll give it a try. Would have loved a solution where i do not need to add two more plugins just because one is slow.

@urish urish referenced this pull request Jan 3, 2015

Closed

Extremely slow #73

@ilanbiala

This comment has been minimized.

Copy link

ilanbiala commented Jan 3, 2015

@terinjokes I'm using gulp-uglify to uglify a concatenated file, so checking if one of them changed and caching it doesn't help me...can we get some caching going on here, too?

@schnittstabil

This comment has been minimized.

Copy link

schnittstabil commented Jan 30, 2015

@ilanbiala One have to know which part of your concatenated file changed, then determine which part of the uglified file corresponds to it and replace the latter by the uglified former.

That won't work. The determination part is the problem: Nobody can predict which optimizations uglify will perform in the future.

The obvious solution to your problem:

  1. uglify using incremental-builds
  2. concat

You may swap the steps during deployment, if it makes a difference in size at all.

@montyanderson

This comment has been minimized.

Copy link

montyanderson commented Jul 13, 2015

Browserify takes about 700ms, whereas Browserify + vinyl-buffer + uglify takes around 3s.
Very annoying!

@blurpis

This comment has been minimized.

Copy link

blurpis commented Mar 24, 2016

I might merge this if it's cleaned up

Great, what would you like me to clean up?

Oh, nothing. I just like my code clean.

...six months later

Actually, do not want. Maybe try using this other tools that don't actually address your issue

@dhazelett

This comment has been minimized.

Copy link

dhazelett commented Mar 24, 2016

We had to ditch gulp-uglify, our builds on average were taking ~54sec. As soon as we turn it off, our build finishes in 4sec. and this is a huge eCom site...

@bancek

This comment has been minimized.

Copy link

bancek commented May 2, 2016

You can try using gulp-fs-cache. It speeds our uglify task from 50sec to 2sec (it only needs to uglify app code, vendor does not change a lot).

https://github.com/bancek/gulp-fs-cache

@igneosaur

This comment has been minimized.

Copy link

igneosaur commented May 10, 2016

Well this was a bit weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment