Skip to content

Serious regression of warp! #60

Closed
@jianghaizhu

Description

@jianghaizhu

Some serious memory allocation and regression in Julia 0.7. Here is a MWE.

julia> img = rand(100, 100);
julia> tfm = recenter(RotMatrix(-pi/4), center(img));

In Julia 0.6,

julia> @btime warp(img, tfm);
  422.876 μs (5 allocations: 157.72 KiB)

In Julia 0.7,

julia> @btime warp(img, tfm);
  8.478 ms (261626 allocations: 9.07 MiB)

Looking at the code of warp!,

function warp!(out, img::AbstractExtrapolation, tform)
    @inbounds for I in CartesianIndices(axes(out))
        out[I] = _getindex(img, tform(SVector(I.I)))
    end
    out       <==== should not return anything
end

Obviously, warp! should not return out. But eliminating the return only helps marginally. But I cannot dig any further. Might be some problem with _getindex.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions