We are seeing a performance regression with a factor of 1.5 or 2.0
(depending on machine) for the following simple C interface code between
0.4.2 and today's master (not sure where the problem initially showed up,
but within the last 50 days):
import Base: +
typealias ZZ Array{UInt, 1}
function +(a::ZZ, b::Int)
r = ZZ(length(a))
ccall((:__gmpn_add_1, :libgmp), Void, (Ptr{UInt}, Ptr{UInt}, Int, Int),
r, a, 3, b)
return r
end
function doit(n::Int)
a = ZZ(3)
a[1] = rand(UInt)
a[2] = rand(UInt)
a[3] = rand(UInt)
for s = 1:n
a += s
end
return a
end
doit(1000000000)
I realise the example is not mathematically very meaningful, nor is it the
best way to compute anything in particular. It's cut down from a larger
example to illustrate the performance regression clearly.
Bill.