grunt
grunt copied to clipboard
`grunt.file.expand` performance on Windows
Code:
console.log('/************* Test *****************/', (new Date()).toISOString());
var t = grunt.file.expand([
'**/*.js',
'!node_modules/**',
'!dist/**',
'!app/jspm_packages/**',
'!app/**/vendor/**',
'!app/config.js'
]);
console.log(t.length, '/************* Test End *****************/', (new Date()).toISOString());
Output:
/************* Test *****************/ 2015-08-17T07:47:40.759Z
21 '/************* Test End *****************/' '2015-08-17T07:56:58.885Z'
The above code was executed on Windows 10 machine, and it took ~9min. But same code on Linux is executing within seconds.
Now if I remove negation patterns then it executes quickly on Windows also.
Using [email protected], you can improve the performance of negations by using glob's new ignore option:
var ignoreGlobs = [
'node_modules/**',
'dist/**',
'app/jspm_packages/**',
'app/**/vendor/**',
'app/config.js'
];
var t = grunt.file.expand({ignore: ignoreGlobs}, ['**/*.js']);