linux – 使用管道时Shell命令慢,中间文件快
发布时间:2020-12-13 18:45:55 所属栏目:Linux 来源:网络整理
导读:有没有人理解处理时间,使用中间文件或使用管道时的巨大差异?我正在使用新的debian挤压服务器上的标准工具将tiff转换为pdf.执行此操作的标准方法是首先转换为ps. 没有管道: root@web5:~# time tiff2ps test.tif test.psreal 0m0.860suser 0m0.744ssys 0m0.1
有没有人理解处理时间,使用中间文件或使用管道时的巨大差异?我正在使用新的debian挤压服务器上的标准工具将tiff转换为pdf.执行此操作的标准方法是首先转换为ps.
没有管道: root@web5:~# time tiff2ps test.tif > test.ps real 0m0.860s user 0m0.744s sys 0m0.112s root@web5:~# time ps2pdf13 -sPAPERSIZE=a4 test.ps > test.pdf real 0m0.667s user 0m0.612s sys 0m0.060s 带管: root@web5:~# time tiff2ps test.tif | ps2pdf13 -sPAPERSIZE=a4 - > test.pdf real 1m6.098s user 0m15.861s sys 0m50.9 在最后一个命令中,gs进程始终为100%. 更新: root@web5:~# strace tiff2ps test.tif > test.ps execve("/usr/bin/tiff2ps",["tiff2ps","test.tif"],[/* 28 vars */]) = 0 brk(0) = 0x1395000 access("/etc/ld.so.nohwcap",F_OK) = -1 ENOENT (No such file or directory) mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x7fb5a1937000 access("/etc/ld.so.preload",R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache",O_RDONLY) = 3 fstat(3,{st_mode=S_IFREG|0644,st_size=21735,...}) = 0 mmap(NULL,21735,PROT_READ,MAP_PRIVATE,3,0) = 0x7fb5a1931000 close(3) = 0 access("/etc/ld.so.nohwcap",F_OK) = -1 ENOENT (No such file or directory) open("/usr/lib/libtiff.so.4",O_RDONLY) = 3 read(3,"177ELF211 3 > |