aboutsummaryrefslogtreecommitdiffstats
path: root/ftp
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2016-11-09 20:14:47 +0800
committermat <mat@FreeBSD.org>2016-11-09 20:14:47 +0800
commitc669566fda83a40284c1b9b22e0a526254e50236 (patch)
tree8db26e6ab14db29b83ecffefbd7121ef798594f9 /ftp
parent359e7c12dfec6a6fed555a2c27b84e5f00c575b0 (diff)
downloadfreebsd-ports-gnome-c669566fda83a40284c1b9b22e0a526254e50236.tar.gz
freebsd-ports-gnome-c669566fda83a40284c1b9b22e0a526254e50236.tar.zst
freebsd-ports-gnome-c669566fda83a40284c1b9b22e0a526254e50236.zip
Optimize COPYTREE_* macros.
The main problem slowing down those macros was that it was ending up calling chmod(1) once for each file and directory. It was doing this because it was running find(1) in the source tree and needed to chmod in the target tree, so it had to append the full path to the chmod(1) calls, which made it impossible to use -exec +. Rewrite the -exec calls to call sh and cd into it before running chmod(1) and do so on as many files as we can using the -exec + construct. While there, optimize a bit more after figuring out that it is possible to only use one find(1) to run two -exec for different options. Also switch to using the more powerfull modern regular expressions instead of the usual basic regular expressions by using find -E. This will allow the use of | which as no basic regular expressions equivalent (as in, for example, "*.(html|txt)") as well as the + and ? keywords, and back references. About the speed gain, I did a few tests, using time's builtin from csh (table with all the data available in the review), comparing the home baked versions of COPYTREE_SHARE found in ports, it boils down to: | version | www/sit (~2k) | www/mathjax (~30k) | +------------+------------------+--------------------+ | home baked | 0.032u 0.104s | 0.946u 7.446s | | current | 0.281u 0.649s | 5.446u 18.626s | | new | 0.024u 0.081s | 0.770u 7.012s | PR: 213614 Submitted by: mat Exp-run by: antoine Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D8283
Diffstat (limited to 'ftp')
0 files changed, 0 insertions, 0 deletions