spine-tools / Spine-Database-API

Database interface to Spine generic data model
https://www.tools-for-energy-system-modelling.org/
GNU Lesser General Public License v3.0
6 stars 5 forks source link

Make updating parameter (default) values faster and add benchmarks #378

Closed soininen closed 3 months ago

soininen commented 3 months ago

updated_parameter_definition() (and similar ways to update values) always parses the new (default) value before comparing it to the old one which can make the call very slow. This PR modifies the code such that we parse the value only if absolutely necessary. This makes cases where the values are completely different (e.g. updates from None to Map) or cases where the values are exactly the same (in database representation) much faster, up to over 300 times according to the performance benchmarks included.

No associated issue.

Checklist before merging