Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive Calls to parameter.__getattr__ #1500

Closed
SamKG opened this issue Feb 28, 2020 · 2 comments
Closed

Excessive Calls to parameter.__getattr__ #1500

SamKG opened this issue Feb 28, 2020 · 2 comments
Labels
bug Should work but doesn't

Comments

@SamKG
Copy link
Collaborator

SamKG commented Feb 28, 2020

From profiling psyneulink code, I found that parameter.__getattr__ was called many times.

For example, in the following code:
from psyneulink.core.components import component

There were about 300,000 calls to parameter.__getattr__.

In addition, creating components in psyneulink seems to also increase the number of calls to
parameter.__getattr__, up to the order of millions of calls.

Testing shows that these calls represent atleast 40% (if not more) of the total time spent when creating nodes and importing psyneulink.

These counts seem a bit excessive; I'm wondering if there may be a bug buried deep in the parameters class - or potential for significant optimization.

@SamKG
Copy link
Collaborator Author

SamKG commented Mar 3, 2020

As discussed in today's meeting, it may be beneficial to refactor the parameter class in its entirety, so that it exists as essentially a wrapper around ctype objects.
This could potentially be more efficient, and also has the added benefit of solving synchronization between compiled psyneulink and python psyneulink.

@SamKG SamKG added the bug Should work but doesn't label Mar 12, 2020
kmantel added a commit that referenced this issue May 8, 2020
@SamKG
Copy link
Collaborator Author

SamKG commented May 9, 2020

Fixed in #1605

@SamKG SamKG closed this as completed May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Should work but doesn't
Projects
None yet
Development

No branches or pull requests

1 participant