Speedup ports install

soralx at cydem.org soralx at cydem.org
Wed Oct 28 05:33:43 UTC 2015


Howdy!

 I have a suggestion: to significantly speedup the packaging phase
 when installing ports, pass '-f tgz' flag to `pkg create`:
   --- Mk/bsd.commands.mk  (revision 400371)
   +++ Mk/bsd.commands.mk  (working copy)
   @@ -126,7 +126,7 @@
    PKG_DELETE?=           ${PKG_BIN} delete -y
    PKG_INFO?=             ${PKG_BIN} info -g
    PKG_VERSION?=          ${PKG_BIN} version
   -PKG_CREATE?=           ${PKG_BIN} create
   +PKG_CREATE?=           ${PKG_BIN} create -f tgz
    PKG_ADD?=              ${PKG_BIN} add
    PKG_QUERY?=            ${PKG_BIN} query

 This way, gzip will be used instead of default xz (which
 is very slow). The extra compression of xz is not needed,
 as the package file will be deleted shortly anyway.

 Same idea applies to portmaster. Change 
   pkg_create="pkg create "
 to
   pkg_create="pkg create -f tgz "
 on line 1916 of 'portmaster' script.

 Ports install a lot faster this way, even on a machine with a fast CPU
 (especially noticeable when doing portupgrade with lots of small ports).

 Example. [root at soralx /usr/ports/science/paraview]# time make package
  With xz:
    ===>  Building package for paraview-4.3.1_1
     real    1m41.120s
     user    1m40.070s
     sys     0m1.089s
  With gzip:
    ===>  Building package for paraview-4.3.1_1
     real    0m15.931s
     user    0m15.010s
     sys     0m0.925s
 Note that `make package` will still produce xz-compressed file after
 the flag is added to "PKG_CREATE"; I changed the behaviour only for
 this example, to demonstrate the time difference (factor of ~6.7).

-- 
[SorAlx]  ridin' VN2000 Classic LT


More information about the freebsd-ports mailing list