Follow-up from #679.
In a calibration loop the network topology is fixed and only the result file changes, but
from_res1d rebuilds the whole graph on every trial. A test user reports 18–25 s per build on a
7,955-node EPANET-backed file, most of it topology, against ~1.5 s for the data they actually need.
They suggest:
network = Network.from_res1d(new_res, topology=existing_network)
which would copy the graph structure from an existing Network and re-read only the data.
This is the largest remaining win from #679. It also sidesteps mikeio1d's _get_total_length
(#684) entirely, since the reach loop never runs.
Open question: how much should we check that the reused topology actually matches the new file?
Options range from documenting it as the caller's responsibility to comparing node and reach counts.
Follow-up from #679.
In a calibration loop the network topology is fixed and only the result file changes, but
from_res1drebuilds the whole graph on every trial. A test user reports 18–25 s per build on a7,955-node EPANET-backed file, most of it topology, against ~1.5 s for the data they actually need.
They suggest:
which would copy the graph structure from an existing
Networkand re-read only the data.This is the largest remaining win from #679. It also sidesteps mikeio1d's
_get_total_length(#684) entirely, since the reach loop never runs.
Open question: how much should we check that the reused topology actually matches the new file?
Options range from documenting it as the caller's responsibility to comparing node and reach counts.