Skip to content

Conversation

ajavadia
Copy link
Member

@ajavadia ajavadia commented May 30, 2018

Removes some unneeded things from _dagcircuit.py that were slowing down compilation:

  • some unnecessary deepcopies, where shallow copy was sufficient
  • an unnecessary check of gate body definitions, where all gate definitions were coming from qiskit/extensions/standard/header.py and thus necessarily equivalent.

I saw 25-50% improvement in compile time on VQE performance benchmarks.

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@ajavadia ajavadia mentioned this pull request May 30, 2018
6 tasks
Copy link
Member

@diego-plan9 diego-plan9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ajavadia - it's extremely nice to see the improvements in performance thanks to the round of PRs 🎉

@diego-plan9 diego-plan9 merged commit df2cbb9 into Qiskit:master Jun 5, 2018
@eddieschoute
Copy link
Contributor

eddieschoute commented Jun 12, 2018

Was there a need to remove the deepcopy method from DAGCircuit? It broke some of my code...

Replace with copy.deepcopy is a straightforward workaround.

I would suggest maybe implementing __copy__ so that users can obtain a shallow copy of a DAGCircuit that you can still modify. (I think copy.copy does not create a copy of the fields such as multi_graph.)

@ajavadia
Copy link
Member Author

@eddieschoute i removed it as it was not getting used anymore. Also that function was just one line of copy.deepcopy, so it's better to use that directly as you mention.

@ajavadia ajavadia deleted the performance-dagcircuit branch July 21, 2018 00:03
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
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

Successfully merging this pull request may close these issues.

3 participants