Skip to content

optimize *count methods #469

Open
Open
@jonenst

Description

@jonenst

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions