Skip to content

Commit

Permalink
Stop using linearindices (#196)
Browse files Browse the repository at this point in the history
Prepare for deprecation of linearindices. This function was not strictly needed here.
  • Loading branch information
nalimilan authored and ararslan committed Apr 12, 2018
1 parent daa4923 commit d2febe0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/find/FindBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,31 @@ const VEC_LENGTH = 1000
if VERSION < v"0.7.0-DEV.3399"

function perf_findnext(x)
s = findnext(x, first(linearindices(x)))
s = findfirst(x)
while s > 0
s = findnext(x, nextind(x, s))
end
s
end

function perf_findprev(x)
s = findprev(x, last(linearindices(x)))
s = findlast(x)
while s > 0
s = findprev(x, prevind(x, s))
end
s
end

function perf_findnext(pred, x)
s = findnext(pred, x, first(linearindices(x)))
s = findfirst(pred, x)
while s > 0
s = findnext(pred, x, nextind(x, s))
end
s
end

function perf_findprev(pred, x)
s = findprev(pred, x, last(linearindices(x)))
s = findlast(pred, x)
while s > 0
s = findprev(pred, x, prevind(x, s))
end
Expand All @@ -89,31 +89,31 @@ if VERSION < v"0.7.0-DEV.3399"
else

function perf_findnext(x)
s = findnext(x, first(linearindices(x)))
s = findfirst(x)
while s !== nothing
s = findnext(x, nextind(x, s))
end
s
end

function perf_findprev(x)
s = findprev(x, last(linearindices(x)))
s = findlast(x)
while s !== nothing
s = findprev(x, prevind(x, s))
end
s
end

function perf_findnext(pred, x)
s = findnext(pred, x, first(linearindices(x)))
s = findfirst(pred, x)
while s !== nothing
s = findnext(pred, x, nextind(x, s))
end
s
end

function perf_findprev(pred, x)
s = findprev(pred, x, last(linearindices(x)))
s = findlast(pred, x)
while s !== nothing
s = findprev(pred, x, prevind(x, s))
end
Expand Down

0 comments on commit d2febe0

Please sign in to comment.