作者:
Neisseria (Neisseria)
2013-12-27 10:43:23這個函數的作用是
利用 dlocate -S $file 這個指令查詢 $file 屬於那個 Debian 套件
http://pastebin.com/K1hJZHLf 請賞光
利用 timeit 跑一次函數的速度約 0.1-0.2 秒之間
因為這個函數是一個中間的步驟
有時候會被執行很多次 結果整個指令執行起來很慢
完整的 script 已經可以用了 只是還很陽春
https://github.com/cwchen123/exe-deps.git
想問各位大大要怎麼加快這個 script 的速度?
[Update]:
後來在 script 中加入 cache 及 multi-threading
其中 cache 的方式用 memoized decorator
multi-threading 透過 multiprocessing
果然速度大有提升 接近 shell commands 的速度 偶而還會更快
不過用 ldd(1) 來查相依性 跟 Debian 套件中標示的相依性還是差一點