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

Improve performance of random_pauli! by 100x #454

Merged
merged 2 commits into from
Dec 29, 2024

Conversation

jlapeyre
Copy link
Contributor

This commit improves the performance of the unbiased branch of random_pauli! by a factor of about 100. Each chunk in the data array is replaced with a random UInt64.

Before:

julia> @time random_pauli(10^9);
  9.596375 seconds (5 allocations: 238.419 MiB, 0.06% gc time)

After:

julia> @btime random_pauli(10^9);
  74.858 ms (5 allocations: 238.42 MiB)

Note:

I included code to unset the noncoding bits in the xz field of PauliOperator. Similar code may already exist somewhere. But I did not find it.

I was unable to find information on details of code formatting.


If you want to submit an unfinished piece of work in order to get comments and discuss, please mark the pull request as a draft and ping the repository maintainer.

Please address only one topic or issue per pull request! Many small PRs are much easier to review and merge than one large PR.

Before merging, all changes and new functionality should be marked in the CHANGELOG file, but feel free to just leave your CHANGELOG notes in the PR description, to avoid merge conflicts with other requests modifying that file. The maintainer will add these CHANGELOG notes for you if you do so.

Before considering your pull request ready for review and merging make sure that all of the following are completed (please keep the clecklist as part of your PR):

  • The code is properly formatted and commented.
  • Substantial new functionality is documented within the docs.
  • All new functionality is tested.
  • All of the automated tests on github pass.
  • We recently started enforcing formatting checks. If formatting issues are reported in the new code you have written, please correct them. There will be plenty of old code that is flagged as we are slowly transitioning to enforced formatting. Please do not worry about or address older formatting issues -- keep your PR just focused on your planned contribution.

jlapeyre and others added 2 commits December 27, 2024 19:23
This commit improves the performance of the unbiased branch of `random_pauli!`
by a factor of about 100. Each chunk in the data array is replaced with a random
`UInt64`.
@Krastanov Krastanov merged commit 3297023 into QuantumSavory:master Dec 29, 2024
15 of 16 checks passed
@Krastanov
Copy link
Member

Thank you, this is great!

For the record, no, we do not have neat masking of the unused bits anywhere else yet. It would be good to be more diligent about that, as currently it can lead to incorrect use in some of the non-public APIs

Copy link

codecov bot commented Dec 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.73%. Comparing base (6065fab) to head (dd4f232).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #454      +/-   ##
==========================================
- Coverage   82.82%   82.73%   -0.09%     
==========================================
  Files          70       70              
  Lines        4651     4656       +5     
==========================================
  Hits         3852     3852              
- Misses        799      804       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

2 participants