Skip to content

Allocation-free code in julia v1.10 shows allocations in julia v1.11 #58168

Open
@fhagemann

Description

@fhagemann

This code used to be allocation-free in julia-1.10 but is not anymore in julia-1.11:

using BenchmarkTools

fmap(fs, x...) = _fmap(x, fs...)
@inline _fmap(x, f, fs...) = (f(x...), _fmap(x, fs...)...)
@inline _fmap(x) = ()

fs = (hypot, atand)
x = 3
y = 4
@btime fmap($fs, $x, $y);

Julia v1.10.8: 51.022 ns (0 allocations: 0 bytes)
Julia v1.11.4: 191.837 ns (3 allocations: 64 bytes)
(The allocations are also observed in julia v1.12.0-beta1: 199.714 ns (3 allocations: 64 bytes))

Is this something that would need to be addressed in the julia source code or can this be avoided by small tweaks to the code? Any help is very much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceMust go fasterregressionRegression in behavior compared to a previous versionregression 1.11Regression in the 1.11 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions