Closed Krastanov closed 3 months ago
some more microbenchmarks showing more clearly the order-of-magnitude difference:
using QuantumSavory
using QuantumSavory.ProtocolZoo
using BenchmarkTools
reg = Register(5)
tag!(reg[3], EntanglementCounterpart, 1, 10)
tag!(reg[3], EntanglementCounterpart, 2, 21)
tag!(reg[3], EntanglementCounterpart, 3, 30)
tag!(reg[3], EntanglementCounterpart, 2, 22)
tag!(reg[3], EntanglementCounterpart, 1, 10)
tag!(reg[3], EntanglementCounterpart, 6, 60)
tag!(reg[3], EntanglementCounterpart, 2, 23)
tag!(reg[3], EntanglementCounterpart, 1, 10)
@benchmark query(reg, EntanglementCounterpart, 6, ❓; filo=true)
##
#=
# before
BenchmarkTools.Trial: 10000 samples with 217 evaluations.
Range (min … max): 349.700 ns … 20.329 μs ┊ GC (min … max): 0.00% … 97.32%
Time (median): 363.272 ns ┊ GC (median): 0.00%
Time (mean ± σ): 393.885 ns ± 410.384 ns ┊ GC (mean ± σ): 3.76% ± 3.76%
▁▃▇█▇▅▃▁▁▃▃▂▁ ▁▂▂▂▂▂▁ ▂
████████████████▇▇▆▇▆▅▆▆▆▄▄▅▃▄▃▄▅▇█▆▇█▇▇▄▃▃▁▃▁▃▄▄▃▆▇█████████ █
350 ns Histogram: log(frequency) by time 519 ns <
Memory estimate: 512 bytes, allocs estimate: 8.
# after
BenchmarkTools.Trial: 10000 samples with 7 evaluations.
Range (min … max): 4.225 μs … 313.888 μs ┊ GC (min … max): 0.00% … 96.58%
Time (median): 4.343 μs ┊ GC (median): 0.00%
Time (mean ± σ): 4.503 μs ± 5.284 μs ┊ GC (mean ± σ): 1.98% ± 1.67%
▄▇█▇▅▃▂ ▂
▆████████▇▆▇▇▇▆▆▅▅▆▄▇█▇▇▅▅▄▅▄▄▅▆▅▅▅▅▅▅▄▅▅▅▄▂▄▅▄▅▅▆▅▃▄▄▄▃▄▄▄ █
4.23 μs Histogram: log(frequency) by time 6.1 μs <
Memory estimate: 3.53 KiB, allocs estimate: 79.
Attention: Patch coverage is 88.70968%
with 7 lines
in your changes missing coverage. Please review.
Project coverage is 73.45%. Comparing base (
10e94f0
) to head (ddb00ea
).
Files | Patch % | Lines |
---|---|---|
src/queries.jl | 87.93% | 7 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This code is drastically simpler than the original implementation, but also much slower:
Kept here as a reference and for potential future work that might be both simpler and faster.