Skip to content

Commit

Permalink
Fix performance of rand(mvf, n)
Browse files Browse the repository at this point in the history
  • Loading branch information
Azzaare committed Nov 16, 2021
1 parent 3d90dbd commit a3086ef
Show file tree
Hide file tree
Showing 53 changed files with 4,900 additions and 2,851 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name = "PatternFolds"
uuid = "c18a7f1d-76ad-4ce4-950d-5419b888513b"
authors = ["Jean-Francois Baffier"]
version = "0.2.1"
version = "0.2.2"

[deps]
Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5"
Lazy = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"

[compat]
Expand Down
4 changes: 2 additions & 2 deletions perf/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,10 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.1.2"

[[deps.PatternFolds]]
deps = ["Intervals", "Lazy", "Reexport"]
deps = ["Intervals", "Lazy", "Random", "Reexport"]
path = "C:\\Users\\jeanf\\.julia\\dev\\PatternFolds"
uuid = "c18a7f1d-76ad-4ce4-950d-5419b888513b"
version = "0.2.1"
version = "0.2.2"

[[deps.PerfChecker]]
deps = ["BenchmarkTools", "CSV", "Coverage", "DataFrames", "Distributed", "LibGit2", "OrderedCollections", "PGFPlotsX", "Pkg", "Plots", "PrettyTables", "Profile", "Random", "StatsPlots"]
Expand Down
60 changes: 30 additions & 30 deletions perf/allocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,10 @@ using PatternFolds
# Target of the alloc check
targets = [PatternFolds]

# function alloc() # 0.2.x
# # Intervals
# itv = Interval{Open,Closed}(0.0, 1.0)
# i = IntervalsFold(itv, 2.0, 1000)

# @info "Checking IntervalsFold" i pattern(i) gap(i) folds(i) size(i) length(i)

# unfold(i)
# collect(i)
# reverse(collect(i))

# # rand(i, 1000)

# # Vectors
# vf = make_vector_fold([0, 1], 2, 1000)
# @info "Checking VectorFold" vf pattern(vf) gap(vf) folds(vf) length(vf)

# unfold(vf)
# collect(vf)
# reverse(collect(vf))

# rand(vf, 1000)

# return nothing
# end

function alloc() #0.1.1-0.1.5
i = IntervalsFold(Interval((0.0, true), (1.0, false)), 2.0, 1000)
function alloc() # 0.2.x
# Intervals
itv = Interval{Open,Closed}(0.0, 1.0)
i = IntervalsFold(itv, 2.0, 1000)

@info "Checking IntervalsFold" i pattern(i) gap(i) folds(i) size(i) length(i)

Expand All @@ -51,16 +27,40 @@ using PatternFolds
# rand(i, 1000)

# Vectors
vf = VectorFold([0, 1], 2, 1000)
vf = make_vector_fold([0, 1], 2, 1000)
@info "Checking VectorFold" vf pattern(vf) gap(vf) folds(vf) length(vf)

unfold(vf)
collect(vf)
reverse(collect(vf))

[rand(vf) for _ in 1:1000]
rand(vf, 1000)

return nothing
end

# function alloc() #0.1.1-0.1.5
# i = IntervalsFold(Interval((0.0, true), (1.0, false)), 2.0, 1000)

# @info "Checking IntervalsFold" i pattern(i) gap(i) folds(i) size(i) length(i)

# unfold(i)
# collect(i)
# reverse(collect(i))

# # rand(i, 1000)

# # Vectors
# vf = VectorFold([0, 1], 2, 1000)
# @info "Checking VectorFold" vf pattern(vf) gap(vf) folds(vf) length(vf)

# unfold(vf)
# collect(vf)
# reverse(collect(vf))

# [rand(vf) for _ in 1:1000]
# end

# Actual call to PerfChecker
alloc_check(title, dependencies, targets, alloc, alloc; path=@__DIR__)
end
60 changes: 30 additions & 30 deletions perf/bench.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,10 @@ using PatternFolds

target = PatternFolds

# function bench() # 0.2.x
# # Intervals
# itv = Interval{Open,Closed}(0.0, 1.0)
# i = IntervalsFold(itv, 2.0, 10^6)

# unfold(i)
# collect(i)
# reverse(collect(i))

# # rand(i, 1000)

# # Vectors
# vf = make_vector_fold([0, 1], 2, 10^6)
# # @info "Checking VectorFold" vf pattern(vf) gap(vf) folds(vf) length(vf)

# unfold(vf)
# collect(vf)
# reverse(collect(vf))

# rand(vf, 1000)

# return nothing
# end

function bench() # 0.1.1-0.1.5
function bench() # 0.2.x
# Intervals
i = IntervalsFold(Interval((0.0, true), (1.0, false)), 2.0, 1000)
itv = Interval{Open,Closed}(0.0, 1.0)
i = IntervalsFold(itv, 2.0, 10^6)

unfold(i)
collect(i)
Expand All @@ -40,20 +17,43 @@ function bench() # 0.1.1-0.1.5
# rand(i, 1000)

# Vectors
vf = VectorFold([0, 1], 2, 1000)
vf = make_vector_fold([0, 1], 2, 10^6)
# @info "Checking VectorFold" vf pattern(vf) gap(vf) folds(vf) length(vf)

unfold(vf)
collect(vf)
reverse(collect(vf))

for _ in 1:1000
rand(vf)
end
rand(vf, 1000)

return nothing
end

# function bench() # 0.1.1-0.1.5
# # Intervals
# i = IntervalsFold(Interval((0.0, true), (1.0, false)), 2.0, 1000)

# unfold(i)
# collect(i)
# reverse(collect(i))

# # rand(i, 1000)

# # Vectors
# vf = VectorFold([0, 1], 2, 1000)
# # @info "Checking VectorFold" vf pattern(vf) gap(vf) folds(vf) length(vf)

# unfold(vf)
# collect(vf)
# reverse(collect(vf))

# for _ in 1:1000
# rand(vf)
# end

# return nothing
# end

t = @benchmark bench() evals = 1 samples = 1000 seconds = 3600

# Actual call to PerfChecker
Expand Down
Loading

0 comments on commit a3086ef

Please sign in to comment.