Skip to content

Performance improvement: limit number of calls to "supported_platforms(filename)" #727

@bertrandhaut

Description

@bertrandhaut

Dear,

We are using fmpy inside a larger application where we are calling numerous times the "simulate_fmu" function with the same FMU.
More precisely, we are simulating a large period (e.g. 1 day) and each call to simulate_fmu is limited to 1 minute.

In the current implementation of FMPY, the function "supported_platforms(filename)" is called each time we call simulate_fmu.

It turns out that the total time spent in "supported_platforms" is around 26% of the total computation time (disk access is really slow)

Of course, in this particular situation, the call to the "supported_platforms" might have been done only once.

I was wondering if it was possible to skip the call to "supported_platforms" when it's not the first call for a given fmu.

Some possibilities might be:

  • cache the results of supported_platforms (e.g. @lru_cache)
  • skip if the user is using some set of arguments (e.g. passing a fmu_instance, initialize=False, remote_platform=None)

What do you think of such modifications?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions