brightway-lca / brightway2-analyzer

BSD 3-Clause "New" or "Revised" License
7 stars 13 forks source link

`get_labeled_inventory` needs better performance for large databases #15

Open cmutel opened 2 years ago

cmutel commented 2 years ago

get_activity(lca.dicts.biosphere.reversed[i]).as_dict() will be slow (1 query per object). Should be 1 database query in total.

BenPortner commented 2 years ago

Perhaps, one could re-use bw2data.backends.iotable.storage.Storage for this? It might be worthwhile investing in a central cache and handler, which can be used to add activity metadata to all kinds of arrays and matrices, be it exchanges, inventory, biosphere_matrix or technosphere_matrix.