trungdong / prov

A Python library for W3C Provenance Data Model (PROV)
http://prov.readthedocs.io/
MIT License
120 stars 44 forks source link

Do not deepcopy the cache! #158

Closed jfennick closed 4 months ago

jfennick commented 4 months ago

Deepcopy'ing the cache is unnecessary and is causing massive performance problems for certain uses cases (specifically, large directories). This change fixes the performance problems.

jfennick commented 4 months ago

Looks like PRs should be opened against the dev branch?

trungdong commented 4 months ago

Thank you for the suggestion. I agree that the deepcopy operation was unnecessary (on the namespace's cache and other parts).

Your suggested edit, however, still uses deepcopy. I would suggest the following:

                # Do not reuse the namespace object, making an identical copy
                ns = self.add_namespace(Namespace(namespace.prefix, namespace.uri))

and we can also remove the deepcopy import that is no longer required.

trungdong commented 4 months ago

@jfennick Merged. Thanks a lot!

jfennick commented 4 months ago

No problem! Any chance for a point release soon? We have some users that are currently affected by this.

trungdong commented 4 months ago

No promise, but I will try to make a release this weekend.

trungdong commented 3 months ago

@jfennick I've made a release. Sorry for the delay.