Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

rm matvec & furthur optimize performance #71

Merged
merged 6 commits into from
Sep 26, 2020
Merged

rm matvec & furthur optimize performance #71

merged 6 commits into from
Sep 26, 2020

Conversation

Roger-luo
Copy link
Member

this further optimizes the performance of rotation gates.

@benchmark apply!(r, $(put(5, 2=>Rx(0.5)))) setup=(r=rand_state(5))

before:

BenchmarkTools.Trial: 
  memory estimate:  688 bytes
  allocs estimate:  17
  --------------
  minimum time:     424.719 ns (0.00% GC)
  median time:      441.246 ns (0.00% GC)
  mean time:        473.802 ns (5.99% GC)
  maximum time:     10.010 μs (95.16% GC)
  --------------
  samples:          10000
  evals/sample:     199

after:

BenchmarkTools.Trial: 
  memory estimate:  32 bytes
  allocs estimate:  2
  --------------
  minimum time:     72.515 ns (0.00% GC)
  median time:      92.314 ns (0.00% GC)
  mean time:        94.292 ns (0.72% GC)
  maximum time:     1.508 μs (93.35% GC)
  --------------
  samples:          10000
  evals/sample:     954

@codecov
Copy link

codecov bot commented Sep 26, 2020

Codecov Report

Merging #71 into master will increase coverage by 0.38%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #71      +/-   ##
==========================================
+ Coverage   80.51%   80.90%   +0.38%     
==========================================
  Files           8        8              
  Lines         544      555      +11     
==========================================
+ Hits          438      449      +11     
  Misses        106      106              
Impacted Files Coverage Δ
src/instruct.jl 95.91% <100.00%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 517f68d...4839165. Read the comment docs.

@GiggleLiu
Copy link
Member

The register size is too small. Do you have benchmark for the larger size?

@Roger-luo
Copy link
Member Author

20 qubits

Before:

BenchmarkTools.Trial: 
  memory estimate:  688 bytes
  allocs estimate:  17
  --------------
  minimum time:     1.470 ms (0.00% GC)
  median time:      1.501 ms (0.00% GC)
  mean time:        1.500 ms (0.00% GC)
  maximum time:     1.558 ms (0.00% GC)
  --------------
  samples:          279
  evals/sample:     1

after:

BenchmarkTools.Trial: 
  memory estimate:  32 bytes
  allocs estimate:  2
  --------------
  minimum time:     1.379 ms (0.00% GC)
  median time:      1.405 ms (0.00% GC)
  mean time:        1.407 ms (0.00% GC)
  maximum time:     1.489 ms (0.00% GC)
  --------------
  samples:          282
  evals/sample:     1

@GiggleLiu
Copy link
Member

GiggleLiu commented Sep 26, 2020

But I don't know why do we need new instructs. Why not fixing the U1 instruction directly?
If you think it is necessary, please add some tests.

src/instruct.jl Outdated Show resolved Hide resolved
src/instruct.jl Outdated Show resolved Hide resolved
src/instruct.jl Outdated Show resolved Hide resolved
Roger-luo and others added 5 commits September 26, 2020 17:21
Co-authored-by: Leo <cacate0129@gmail.com>
Co-authored-by: Leo <cacate0129@gmail.com>
Co-authored-by: Leo <cacate0129@gmail.com>
@Roger-luo Roger-luo merged commit 4946146 into master Sep 26, 2020
@Roger-luo Roger-luo deleted the rm_matvec branch September 26, 2020 22:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants