Speedup ports install

Kubilay Kocak koobs at FreeBSD.org
Wed Oct 28 06:26:31 UTC 2015

On 28/10/2015 4:05 PM, soralx at cydem.org wrote:
> 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).

I would recommend creating a Bugzilla issue for this under the 'Ports &
Packages' Product, "Ports Framework" Component. It will be automatically
assigned to portmgr@ who can make a call on this proposal.

I'd also suggest commenting the entry (in your patch) so that its clear
why its being done. Something like:

# Use tgz (over xz) here for better installation performance

Nice work!


More information about the freebsd-ports mailing list