Hi Lukas,
I noticed a possible performance regression in AC_hamiltonian when upgrading MPSKit from v0.13.10 to v0.13.11.
With the same benchmark setup, the runtime increased by about 3x, and both allocations and memory usage also increased significantly.
The benchmark file:
using Pkg
Pkg.activate("./benchmark/v0.13.11")#Pkg.activate("./benchmark/v0.13.10")
using TensorKit
using MPSKit
using BenchmarkTools
using MPSKitModels
using MPSKit:AC_hamiltonian
H = hubbard_model(ComplexF64, U1Irrep, U1Irrep, FiniteStrip(6, 36);
t=1.0, U=8.0)
I = FermionParity ⊠ U1Irrep ⊠ U1Irrep
Vs = repeat([Vect[I]((Int(!isinteger(i)), j, i) => 1 for i in -1//2:1//2:1//2 for j in 0:1:2),], length(H) - 1)
Ps = Vect[I]( (0, 0, 0) => 1, (1, 1, 1 // 2) => 1, (1, 1, -1 // 2) => 1, (0, 2, 0) => 1)
ψ = FiniteMPS(rand, ComplexF64, [Ps for _ in 1:length(H)], Vs)
envs = environments(ψ, H)
pos = 18
@benchmark AC_hamiltonian($pos, $ψ, $H, $ψ, $envs)
The results for v0.13.11:
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 270.792 μs … 38.010 ms ┊ GC (min … max): 0.00% … 99.10%
Time (median): 279.584 μs ┊ GC (median): 0.00%
Time (mean ± σ): 296.238 μs ± 519.850 μs ┊ GC (mean ± σ): 4.80% ± 3.07%
▄▅▂ ▄█▇▁
▁▂▅████████▇▇▆▅▄▄▄▃▃▂▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
271 μs Histogram: frequency by time 331 μs <
Memory estimate: 224.31 KiB, allocs estimate: 3276.
Activating project at `~/Library/Mobile Documents/com~apple~CloudDocs/mygit/projects/005_tWSe2_SC/benchmark/v0.13.11`
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 280.667 μs … 10.841 ms ┊ GC (min … max): 0.00% … 96.77%
Time (median): 288.334 μs ┊ GC (median): 0.00%
Time (mean ± σ): 303.150 μs ± 352.033 μs ┊ GC (mean ± σ): 4.00% ± 3.35%
▃█▅ ▁▃▂
▁▄████████▆▆▆▅▄▄▃▃▂▂▂▂▂▂▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
281 μs Histogram: frequency by time 342 μs <
Memory estimate: 245.31 KiB, allocs estimate: 3476.
Activating project at `~/Library/Mobile Documents/com~apple~CloudDocs/mygit/projects/005_tWSe2_SC/benchmark/v0.13.11`
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 279.083 μs … 11.605 ms ┊ GC (min … max): 0.00% … 97.08%
Time (median): 288.333 μs ┊ GC (median): 0.00%
Time (mean ± σ): 302.309 μs ± 351.142 μs ┊ GC (mean ± σ): 3.82% ± 3.20%
▆█▃▁▅▇▃
▁▁▂▆███████▇▆▅▄▄▃▃▃▂▂▂▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
279 μs Histogram: frequency by time 342 μs <
Memory estimate: 245.31 KiB, allocs estimate: 3476.
The results for v0.13.10:
Activating project at `~/Library/Mobile Documents/com~apple~CloudDocs/mygit/projects/005_tWSe2_SC/benchmark/v0.13.10`
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 93.416 μs … 10.863 ms ┊ GC (min … max): 0.00% … 98.01%
Time (median): 97.291 μs ┊ GC (median): 0.00%
Time (mean ± σ): 102.598 μs ± 212.520 μs ┊ GC (mean ± σ): 4.11% ± 1.97%
▃▃▄█▆▃
▁▁▃▆███████▇▅▄▃▃▃▃▂▂▂▂▂▁▂▁▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
93.4 μs Histogram: frequency by time 120 μs <
Memory estimate: 77.75 KiB, allocs estimate: 1171.
Activating project at `~/Library/Mobile Documents/com~apple~CloudDocs/mygit/projects/005_tWSe2_SC/benchmark/v0.13.10`
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 94.000 μs … 14.540 ms ┊ GC (min … max): 0.00% … 98.23%
Time (median): 98.750 μs ┊ GC (median): 0.00%
Time (mean ± σ): 105.478 μs ± 265.247 μs ┊ GC (mean ± σ): 4.97% ± 1.97%
▃██▅▅▅▇▅▆▅▄▁
▁▄████████████▇▅▄▄▄▄▃▃▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▁▂▁▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▃
94 μs Histogram: frequency by time 125 μs <
Memory estimate: 77.75 KiB, allocs estimate: 1171.
Activating project at `~/Library/Mobile Documents/com~apple~CloudDocs/mygit/projects/005_tWSe2_SC/benchmark/v0.13.10`
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
Range (min … max): 93.208 μs … 165.725 ms ┊ GC (min … max): 0.00% … 99.60%
Time (median): 99.666 μs ┊ GC (median): 0.00%
Time (mean ± σ): 131.588 μs ± 1.791 ms ┊ GC (mean ± σ): 19.49% ± 1.98%
▂▅█▃
▂████▇▆▅▅▄▄▄▃▃▃▃▃▃▃▂▂▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
93.2 μs Histogram: frequency by time 162 μs <
Memory estimate: 77.75 KiB, allocs estimate: 1171.
Hi Lukas,
I noticed a possible performance regression in
AC_hamiltonianwhen upgrading MPSKit fromv0.13.10tov0.13.11.With the same benchmark setup, the runtime increased by about 3x, and both allocations and memory usage also increased significantly.
The benchmark file:
The results for v0.13.11:
The results for v0.13.10: