[英]Grunt newer is very slow
我有一個復制任務,它將所有文件(某些目錄中的某些文件除外)復制到另一個目錄中。 然后將這些目錄中的文件剝離(使用grunt-strip-code)。
復制任務很慢,因此我嘗試使用grunt-newer來復制修改過的文件來加快速度。 但是更新似乎和副本本身一樣慢。
這是在沒有較新任務的情況下,用咕gr時間衡量的性能:
Execution Time (2016-10-18 13:10:14 UTC+2)
loading tasks 849ms ██ 1%
copy:copyApp 1m 33.7s ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 99%
Total 1m 34.5s
這是使用更新的grunt衡量的性能,並且沒有更改(即無需執行復制):
$ grunt newer:copy:copyApp
Reading build.properties
Running "newer:copy:copyApp" (newer) task
No newer files to process.
Done, without errors.
Execution Time (2016-10-18 13:33:26 UTC+2)
loading tasks 2.8s ███████ 4%
newer:copy:copyApp 1m 6.2s ██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 96%
Total 1m 9s
這是Gruntfile配置復制任務的一部分:
grunt.config('copy', {
copyApp: {
src: ["**", "!**/dist/**", "!**/build.properties", "!**/Grunt*", "!**/node_modules/**", "!**/comp/**", "!**/package*"],
dest: compPathNtvApp
}
} );
這就是我使用grunt-new的方式:
grunt.registerTask('test', 'newer:copy:copyApp');
我期望使用更新的grunt可以有效提高性能。 我錯了,還是我犯了一些錯誤?
我發現主要問題是由於以下原因:
src: ["**", "!**/dist/**", "!**/build.properties", "!**/Grunt*", "!**/node_modules/**", "!**/comp/**", "!**/package*"],
如果我使用過濾器代替minimatch / glob,則性能會大大提高
$ grunt newer:copy:copyApp
Reading build.properties
Running "newer:copy:copyApp" (newer) task
Running "copy:copyApp" (copy) task
Created 1 directory
Done, without errors.
Execution Time (2016-10-18 16:45:37 UTC+2)
loading tasks 650ms ███████ 4%
newer:copy:copyApp 16.2s ██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 96%
Total 16.9s
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.