Skip to content

Test checking allocation of using an integer or mutable as key in Dict sometimes fail on CI #57391

@KristofferC

Description

@KristofferC

The test in

# Issue #10208 - Unnecessary boxing for calling objectid
struct FooDictHash{T}
x::T
end
function f_dict_hash_alloc()
d = Dict{FooDictHash{Int},Int}()
for i in 1:10000
d[FooDictHash(i)] = i+1
end
d
end
function g_dict_hash_alloc()
d = Dict{Int,Int}()
for i in 1:10000
d[i] = i+1
end
d
end
# Warm up
f_dict_hash_alloc(); g_dict_hash_alloc();
@test abs((@allocated f_dict_hash_alloc()) / (@allocated g_dict_hash_alloc()) - 1) < 0.1 # less that 10% difference

seems to be a bit flaky. Errored on CI (https://buildkite.com/julialang/julia-release-1-dot-12/builds/10#0194fe6a-8efc-4a90-af48-f19bc8aa1161) with:

julia/Compiler/test/codegen.jl:412 =# @allocated(g_dict_hash_alloc()) - 1) < 0.1
--
  | Evaluated: 0.16517549896765304 < 0.1

Test introdocued in #31771. Modified in #55223.

cc @Keno, @d-netto.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciContinuous integrationduplicateIndicates similar issues or pull requests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions