depending on the size of your vectors and the size of the numbers it may be worth preallocating test
this does not reflect the updates above though
function isperm3(test,a,b)
fill!(test,0)
while a > 0 && b > 0
a, a_ind = divrem(a, 10)
b, b_ind = divrem(b, 10)
test[a_ind + 1] += 1
test[b_ind + 1] -= 1
end
a != 0 || b != 0 && return false
!any(!=(0), test)
end
function isperm3(a::Vector,b::Vector)
sz=length(a)
res = falses(sz)
test = fill(0, 10)
@inbounds for i=1:sz
res[i] = _isperm(test,a[i],b[i])
end
return res
end
@btime isPerm2.($x,$y); # 103 micro seconds
@btime isperm3($x,$y) #70 micro seconds