Skip to content

1.15.7

Compare
Choose a tag to compare
@github-actions github-actions released this 09 May 04:44
· 2712 commits to master since this release

Description

Abstract

Replace non-efficient implementation in EntityBase::setOtherStatus function

Background

scenario_simulator_v2 was too slow, so we have to speed up for supporting a lot of entities.

In previous version, EntityBase::setOtherStatus function was this.

void EntityBase::setOtherStatus(
  const std::unordered_map<std::string, CanonicalizedEntityStatus> & status)
{
  other_status_.clear(); // clear previous status
  for (const auto & [other_name, other_status] : status) {
    if (other_name != name) {
      other_status_.emplace(other_name, other_status); // emplace status if the status comes from another entity.
    }
  }
}

It was not efficient.

Details

So, I replace it as

void EntityBase::setOtherStatus(
  const std::unordered_map<std::string, CanonicalizedEntityStatus> & status) {
  other_status_ = status;
  other_status_.erase(name);
}

This PR is depends on #1237 and #1238

References

#1237
#1238

performance

before

Screenshot from 2024-05-09 10-05-57

This process took up 2.2% of the total processing time.

after

Screenshot from 2024-05-09 10-06-36

This process now takes 1.5% of the total processing time.

Destructive Changes

N/A

Known Limitations

N/A

Related Issues