Skip to content

Commit

Permalink
Enable precompilation for 1.9+
Browse files Browse the repository at this point in the history
Before:
```
julia> versioninfo()
Julia Version 1.9.0-DEV.245
Commit 6ce817b0c65 (2022-03-24 16:15 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 1700 Eight-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, znver1)
  Threads: 1 on 16 virtual cores

julia> @time @eval using QuantumClifford
[ Info: Precompiling QuantumClifford [0525e862-1e90-11e9-3e4d-1b39d7109de1]
 14.053087 seconds (5.01 M allocations: 360.354 MiB, 4.55% compilation time)

-- restart

julia> @time @eval using QuantumClifford
  3.856053 seconds (4.99 M allocations: 360.481 MiB, 15.90% compilation time)

julia> @time @eval QuantumClifford._my_precompile_()
 11.705291 seconds (14.09 M allocations: 891.509 MiB, 4.73% gc time, 99.86% compilation time)
```

After:
```
julia> @time @eval using QuantumClifford
[ Info: Precompiling QuantumClifford [0525e862-1e90-11e9-3e4d-1b39d7109de1]
 18.326394 seconds (5.15 M allocations: 376.262 MiB, 3.41% compilation time)

-- restart

julia> @time @eval using QuantumClifford
  3.997577 seconds (5.14 M allocations: 375.149 MiB, 15.05% compilation time)

julia> @time @eval QuantumClifford._my_precompile_()
  9.694973 seconds (5.93 M allocations: 365.762 MiB, 3.07% gc time, 99.84% compilation time)
```
  • Loading branch information
Krastanov committed Mar 24, 2022
1 parent 7a3c74a commit 5a39c82
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Implement `length` for `[Mixed]Destabilizer`.
- Clean up code repetition between `project!` and `projectX/Y/Z!`.
- More conversion constructors between different tableau types.
- Implement pre-compilation examples (again) for julia 1.9+.

## v0.4.2

Expand Down
2 changes: 1 addition & 1 deletion src/precompiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ function _precompile_()
_my_precompile_()
end

#_precompile_()
VERSION > v"1.8" && _precompile_()
4 changes: 2 additions & 2 deletions test/test_allocations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ function test_allocations()
g = enumerate_single_qubit_gates(i,qubit=10,phases=phases)
f5() = apply!(s,g)
f5()
@test allocated(f5) < 100*n
@test allocated(f5) < 130*n
end
for g in [sSWAP(10,200), sCNOT(10,200)]
f6() = apply!(s,g)
f6()
@test allocated(f6) < 150*n
@test allocated(f6) < 170*n
end
end
@testset "project!" begin
Expand Down

0 comments on commit 5a39c82

Please sign in to comment.