benducke / Network-reconstruction-tools-for-GRASS-GIS

Node-based network model generator for GRASS GIS 7.x (and QGIS 3.x)
GNU General Public License v3.0
4 stars 1 forks source link

v.net.models: Speed up point attributes processing loop #57

Closed benducke closed 1 month ago

benducke commented 2 months ago

Currently, v.net.models spends considerable time in an inner and outer loop construct following this message:

Transferring input point attributes to output lines (links):

There are some opportunities for optimization:

  1. There is one v.db.select call in the outer loop that could be replaced with db.execute.
  2. There is a call to grep in the inner(!) loop, which could be replaced with an internal list search function.
  3. There is potential for SQL chunk processing in the inner loop (see related issue: #56 ).
benducke commented 1 month ago

res=echo "${previous}" | "${GREP}" " ${cur} " -c # TODO: Check if replacing this with an internal list search function improves performance

benducke commented 1 month ago

Done with https://github.com/benducke/Network-reconstruction-tools-for-GRASS-GIS/commit/e63214b3e90dabce20611ef789b87c05090f98f6