V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
lu18887
V2EX  ›  问与答

为何 Mac OS X 在命令行下 find 一个目录会比较耗时?

  •  
  •   lu18887 · Oct 22, 2014 · 3584 views
    This topic created in 4205 days ago, the information mentioned may be changed or developed.
    lu18887deMacBook-Pro:data lu18887$ date
    2014年10月22日 星期三 20时28分24秒 CST
    lu18887deMacBook-Pro:data lu18887$ find . -name "20140509" -type d
    ./20140509
    lu18887deMacBook-Pro:data lu18887$ date
    2014年10月22日 星期三 20时28分32秒 CST
    lu18887deMacBook-Pro:data lu18887$



    当前目录下,只有85个目录,名字全是2014xxxx,这性能简直差到让人不敢相信啊,RMBP 13……
    3 replies    2014-10-23 09:21:00 +08:00
    lu18887
        1
    lu18887  
    OP
       Oct 22, 2014
    去掉后面的 -type d 之后快了很多。
    yangg
        2
    yangg  
       Oct 22, 2014 via iPad
    看时间可以直接在用 “time find”
    lu18887
        3
    lu18887  
    OP
       Oct 23, 2014
    @yangg 谢了,学了一招!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2758 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 15:42 · PVG 23:42 · LAX 08:42 · JFK 11:42
    ♥ Do have faith in what you're doing.