firstandthird / load-grunt-config

Grunt plugin that lets you break up your Gruntfile config by task
firstandthird.github.io/load-grunt-config/
MIT License
374 stars 64 forks source link

It should be much faster.. #78

Open johannesjo opened 10 years ago

johannesjo commented 10 years ago

With this little function the watch task is about 3 to 4 times faster, as it is with load-grunt-config:

var loadConfig = function (path, grunt)
{
    var glob = require('glob');
    var object = {};
    var key;

    glob.sync('*', { cwd: path }).forEach(function (option)
    {
        key = option.replace(/\.js$/, '');
        object[key] = require(path + option);
    });

    return object;
};
// ... later
grunt.initConfig(loadConfig('myconfigpath'));

    // jit-grunt
    require('jit-grunt')(grunt, {
        sprite: 'grunt-spritesmith'
    });
jgallen23 commented 10 years ago

I'm not sure I follow... Can you try to explain in more detail?

SolomoN-ua commented 10 years ago

If you talking about jit-grunt, yes it's much faster then load-grunt-tasks. And if you want, you can use it with load-grunt-config, just take a look into documentation

johannesjo commented 10 years ago

No I'm already using jit-grunt. Without its even slower. With load-grunt-config the loading-tasks task takes about 1s (using time-grunt). With the method described above it takes about 200-400 miliseconds.

SolomoN-ua commented 10 years ago

@jgallen23 correct me if I'm wrong, but as I know load-grunt-config uses pretty much the same algorithm inside, only difference is that load-grunt-config is doing little bit more work than just loading tasks.

@johannesjo sorry, but I don't get what is your main point in this issue. :(

johannesjo commented 10 years ago

@SolomoN-ua The whole point is to show, that the module is way slower than it should be. The modules readconfigdir.js should be rewritten to be as fast, as it could be (only in my humble opinion of course).

Also jit-grunt is much faster.

SolomoN-ua commented 10 years ago

Hi @johannesjo, can you provide a PR for this?