Skip to content

Commit

Permalink
Fix abstract, add indvec perf test
Browse files Browse the repository at this point in the history
  • Loading branch information
IainNZ committed Sep 17, 2014
1 parent 63146b5 commit 480883c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type IndexedVector{T}
elts::Vector{T}
nzidx::Vector{Int}
nnz::Int
empty::BitArray
empty::BitArray{1}
end

IndexedVector{T}(::Type{T},n::Integer) = IndexedVector(zeros(T,n),zeros(Int,n),0,trues(n))
Expand Down
22 changes: 22 additions & 0 deletions test/perf/indvec.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using JuMP

function bench_add(n)
v = JuMP.IndexedVector(Float64,n)
for i = 1:2:n
JuMP.addelt!(v, i, 1.0)
end
for i = 2:2:n
JuMP.addelt!(v, i, 1.0)
end
for i = 1:3:n
JuMP.addelt!(v, i, 1.0)
end
end

bench_add(10)
gc_disable()
@time bench_add(1000000)
@time bench_add(1000000)
@time bench_add(1000000)
gc_enable()

0 comments on commit 480883c

Please sign in to comment.