-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Move QPY version regex construction to import time #8235
Conversation
As pointed out by @nkanazawa1989 in Qiskit#8232 the regex construction added to the QPY interface functions in Qiskit#8200 can be a significant portion of the overall function time especially for smaller inputs. Especially as we're building it on every call interface function call. To ameliorate that cost this commit compiles the version regex a single time at the module level. This adds the overhead to import but it will only be done once which should be a net improvement in performance.
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me - my quick search showed these two instances as the only uses of the regex as well (other than the test suite).
Pull Request Test Coverage Report for Build 2556896243
💛 - Coveralls |
* Move QPY version regex construction to import time As pointed out by @nkanazawa1989 in #8232 the regex construction added to the QPY interface functions in #8200 can be a significant portion of the overall function time especially for smaller inputs. Especially as we're building it on every call interface function call. To ameliorate that cost this commit compiles the version regex a single time at the module level. This adds the overhead to import but it will only be done once which should be a net improvement in performance. * Fix regex flags usage Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit ebf800a)
* Move QPY version regex construction to import time As pointed out by @nkanazawa1989 in #8232 the regex construction added to the QPY interface functions in #8200 can be a significant portion of the overall function time especially for smaller inputs. Especially as we're building it on every call interface function call. To ameliorate that cost this commit compiles the version regex a single time at the module level. This adds the overhead to import but it will only be done once which should be a net improvement in performance. * Fix regex flags usage Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit ebf800a) Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
* Copy Qiskit/qiskit#8055 Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * Copy qpy changes from Qiskit/qiskit#8093 Co-authored-by: Jake Lishman <jake@binhbar.com> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> * Copy Qiskit/qiskit#8200 Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * Copy of Qiskit/qiskit#7300 Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * Copy of Qiskit/qiskit#8235 Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Jake Lishman <jake@binhbar.com> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Summary
As pointed out by @nkanazawa1989 in #8232 the regex construction added
to the QPY interface functions in #8200 can be a significant portion of
the overall function time especially for smaller inputs. Especially as
we're building it on every call interface function call. To ameliorate
that cost this commit compiles the version regex a single time at the
module level. This adds the overhead to import but it will only be done
once which should be a net improvement in performance.
Details and comments