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

Resolve regression from introduction of AER::Config #1747

Merged
merged 3 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions releasenotes/notes/avoid_copy_of_config-7f7891864c1a1bd0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
fixes:
- |
Performance regression due to introduction of ``AER::Config`` is fixed.
This class has many fields but is frequently copied in ``AER::Transpile::CircuitOptimization``.
Originally ``json_t`` (former class for configuration) was also frequently copied but
it does have entries in most cases and then this copy overhead is not a problem.
With this fix, ``AER::Transpile::CircuitOptimization`` does not copy ``AER::Config``.
5 changes: 1 addition & 4 deletions src/transpile/circuitopt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ class CircuitOptimization {
const Operations::OpSet &opset,
ExperimentResult &result) const = 0;

virtual void set_config(const Config &config);
virtual void set_config(const Config &config){};

protected:
Config config_;
};

void CircuitOptimization::set_config(const Config &config) { config_ = config; }

//-------------------------------------------------------------------------
} // end namespace Transpile
} // end namespace AER
Expand Down
2 changes: 1 addition & 1 deletion src/transpile/fusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ void Fusion::set_config(const Config &config) {
threshold = config.fusion_threshold.value();

for (std::shared_ptr<Fuser> &fuser : fusers)
fuser->set_config(config_);
fuser->set_config(config);

if (config.fusion_allow_kraus.has_value())
allow_kraus = config.fusion_allow_kraus.value();
Expand Down