Skip to content

Unexpected allocation in sort! of Int64 view #47152

@rickbeeloo

Description

@rickbeeloo

Hey!

Allocations are made when sorting a view of an Int64 array (tested on 1.7.3 and 1.8.0), as discussed here on discourse. @mkoculak spotted that such allocations do not occur for Float64:

x = [2,1,10,15,20]
y = [2.0,1.0,10.0,15.0,20.0]

@btime sort!(view($x,2:4))
33.898 ns (2 allocations: 96 bytes)

@btime sort!(view($y,2:4))
19.645 ns (0 allocations: 0 bytes)

I guess allocations should also not be required for Int64?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions