Testes de tempo das conversões com base nas respostas disponíveis e um pequeno conjunto de dados.
Conjunto de dados de teste
Diretórios do Shapefiles da ESRI
URAU_RG_100K_2011_2014_AT001L2
URAU_RG_100K_2011_2014_AT002L2
URAU_RG_100K_2011_2014_AT003L2
URAU_RG_100K_2011_2014_AT004L2
URAU_RG_100K_2011_2014_AT005L2
URAU_RG_100K_2011_2014_AT006L1
URAU_RG_100K_2011_2014_UK546L0
que inclui os seguintes 9 arquivos .poly
URAU_RG_100K_2011_2014_AT001L2/URAU_RG_100K_2011_2014_AT001L2_0.poly
URAU_RG_100K_2011_2014_AT002L2/URAU_RG_100K_2011_2014_AT002L2_0.poly
URAU_RG_100K_2011_2014_AT003L2/URAU_RG_100K_2011_2014_AT003L2_0.poly
URAU_RG_100K_2011_2014_AT004L2/URAU_RG_100K_2011_2014_AT004L2_0.poly
URAU_RG_100K_2011_2014_AT005L2/URAU_RG_100K_2011_2014_AT005L2_0.poly
URAU_RG_100K_2011_2014_AT006L1/URAU_RG_100K_2011_2014_AT006L1_0.poly
URAU_RG_100K_2011_2014_UK546L0/URAU_RG_100K_2011_2014_UK546L0_0.poly
URAU_RG_100K_2011_2014_UK546L0/URAU_RG_100K_2011_2014_UK546L0_1.poly
URAU_RG_100K_2011_2014_UK546L0/URAU_RG_100K_2011_2014_UK546L0_2.poly
vai lançar 9 trabalhos em paralelo
Bifurcação
for SHAPEFILE in URAU_RG_100K_2011_2014_[A-Z]*[0-9]/ ;do cd $SHAPEFILE && for POLYGON in *.poly ;do time osmconvert --drop-version $OSMSOURCE -B=$POLYGON --out-o5m > $(basename $OSMSOURCE .o5m |tr "-" "_")_$(basename $POLYGON .poly).o5m & done && cd .. ;done
real 6m0.951s
user 5m36.869s
sys 0m20.298s
real 6m23.591s
user 5m43.808s
sys 0m20.336s
real 6m24.066s
user 5m44.619s
sys 0m19.936s
real 6m24.129s
user 5m45.239s
sys 0m19.378s
real 6m29.208s
user 5m43.094s
sys 0m19.314s
real 6m30.974s
user 5m44.318s
sys 0m19.870s
real 6m33.625s
user 5m45.233s
sys 0m19.658s
real 6m33.731s
user 5m45.712s
sys 0m20.001s
real 6m41.014s
user 6m15.112s
sys 0m19.571s
Paralelo GNU
for SHAPEFILE in URAU_RG_100K_2011_2014_[A-Z]*[0-9]*/ ;do cd "$SHAPEFILE"; for POLYGON in *.poly ;do echo "cd '$SHAPEFILE'; time osmconvert --drop-version '$OSMSOURCE' -B='$POLYGON' --out-o5m > $(basename $OSMSOURCE .o5m |tr "-" "_")_$(basename $POLYGON .poly).o5m"; done; cd ..; done |parallel -j 10
real 6m19.005s
user 5m42.739s
sys 0m18.798s
real 6m26.939s
user 5m44.689s
sys 0m19.257s
real 6m27.152s
user 5m44.597s
sys 0m19.644s
real 6m28.821s
user 5m41.650s
sys 0m18.283s
real 6m38.174s
user 5m44.367s
sys 0m19.564s
real 6m40.277s
user 5m45.000s
sys 0m19.650s
real 6m39.940s
user 5m45.421s
sys 0m19.208s
real 6m40.285s
user 5m45.443s
sys 0m19.393s
real 6m40.428s
user 5m48.828s
sys 0m18.871s
Usando nomes absolutos de caminho e arquivo
for SHAPEFILE in URAU_RG_100K_2011_2014_[A-Z]*[0-9]*/ ;do for POLYGON in $SHAPEFILE*.poly ;do echo "time osmconvert --drop-version --out-o5m $OSMSOURCE -B=$(readlink -f $POLYGON) > $(dirname 'readlink -f $POLYGON')/$(basename ${OSMSOURCE%.o5m})_$(basename ${POLYGON%.poly}).o5m" ;done ;done |parallel -j 10
real 6m6.919s
user 5m39.203s
sys 0m19.659s
real 6m23.779s
user 5m43.835s
sys 0m19.225s
real 6m26.033s
user 5m45.370s
sys 0m19.235s
real 6m26.871s
user 5m46.124s
sys 0m19.780s
real 6m33.355s
user 5m41.902s
sys 0m18.556s
real 6m34.368s
user 5m42.973s
sys 0m19.156s
real 6m37.063s
user 5m46.169s
sys 0m19.669s
real 6m37.363s
user 5m46.846s
sys 0m19.194s
real 6m37.428s
user 5m49.679s
sys 0m19.674s
Definindo uma função de shell
OSMSOURCE=$(realpath europe-latest.o5m)
export OSMSOURCE
osmpolyclip() {
cd "$1"
POLYGON="$2"
osmconvert --drop-version $OSMSOURCE -B=$POLYGON --out-o5m > $(basename $OSMSOURCE .o5m |tr "-" "_")_$(basename $POLYGON .poly).o5m
}
e
parallel time osmpolyclip {//} {/} ::: URAU_[A-Z]*[0-9]/*.poly
real 6m19.749s
user 5m41.909s
sys 0m19.162s
real 6m23.559s
user 5m43.881s
sys 0m18.748s
real 6m34.149s
user 5m41.859s
sys 0m18.895s
real 6m38.776s
user 5m44.614s
sys 0m18.767s
real 6m38.817s
user 5m44.420s
sys 0m19.038s
real 6m39.421s
user 5m46.060s
sys 0m18.819s
real 6m39.889s
user 5m45.917s
sys 0m19.541s
real 6m39.956s
user 5m48.368s
sys 0m19.742s
real 6m51.397s
user 6m26.095s
sys 0m19.306s
No entanto, esse é um conjunto de testes mínimo, comparado aos milhares de arquivos Polygon a serem solicitados para conversão. Além disso, os arquivos residem em um diretório remoto que efetivamente reduz a leitura e a escrita.