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

optimize *count methods #469

Open
jonenst opened this issue Oct 16, 2024 · 0 comments
Open

optimize *count methods #469

jonenst opened this issue Oct 16, 2024 · 0 comments

Comments

@jonenst
Copy link
Collaborator

jonenst commented Oct 16, 2024

Describe the current behavior

*count methods always fetch the whole collection and then count

NetworkImpl.getXYZCount()
VoltageLevelImpl.getXYZCount()
SubstationImpl.getXYZCount()

Describe the expected behavior

if the collection is not loaded, a light request to the server getting only the count

Describe the motivation

performance and less resources usage

Extra Information

Note that this would not be optimal for code like
network.getGeneratorCount() ; // load only the count from the server
network.getGenerators(); // now load all the generators

But this looks negligible compared to the improvement of not loading everything in cases were you only want the count. And if it really matter, code can be rewrite to call .size() directly on the getGenerators() instead of calling getGeneratorCount()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant