Skip to content

Commit

Permalink
fix performance bug
Browse files Browse the repository at this point in the history
fixnext API is awkward
  • Loading branch information
vtjnash authored and JeffBezanson committed Jun 7, 2021
1 parent a309437 commit 3575dfe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base/strings/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ function replace(str::String, pat_repl::Vararg{Pair,N}; count::Integer=typemax(I
if r === nothing || first(r) == 0
return e1+1:0
end
r isa Int && (r = r:r) # findnext / performance fix
return r
end
if all(>(e1), map(first, rs))
Expand Down Expand Up @@ -574,6 +575,7 @@ function replace(str::String, pat_repl::Vararg{Pair,N}; count::Integer=typemax(I
if r === nothing || first(r) == 0
return e1+1:0
end
r isa Int && (r = r:r) # findnext / performance fix
end
return r
end
Expand Down

0 comments on commit 3575dfe

Please sign in to comment.