Manage a local cache of minified script, before / after minification. Compute content hash for pre-min script.
If on subsequent build, the concatenated script that is going through the min task has not changed (by comparing previous sha1 for the file and the current one), then don't re-minify but use the cache version.
This little thing should drastically speed up the build script for mid-to-large sized app (this is handy for times when you're trying out different scripts build target or tweaking the config to see how it goes).
I suspect this to be the same for img optim, with sites with a lot of images. I didn't run into this issue yet though.