JuliaLang/julia

objectid takes arbitrarily long

Open

#43,542 创建于 2021年12月24日

在 GitHub 查看
 (9 评论) (1 反应) (0 负责人)Julia (5,773 fork)batch import
Hacktoberfestgood first issuehashingperformance

仓库指标

Star
 (48,709 star)
PR 合并指标
 (平均合并 20天 6小时) (30 天内合并 157 个 PR)

描述

In the following code, I construct a large deeply nested DAG and then call objectid on the root node. I'm expecting this to be instant, but instead the call to objectid takes time proportional to the size of the data structure. With the size 100 used below it probably won't return ever.

struct Foo
  x::Any
  y::Any
end
function test()
  foo = Foo(nothing, nothing)
  for i in 1:100
    foo = Foo(foo, foo)
  end
  println(1)
  println(objectid(foo))
  println(2)
end
test()

Version info:

julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, broadwell)

贡献者指南