JuliaLang/julia

objectid takes arbitrarily long

Open

#43,542 opened on Dec 24, 2021

View on GitHub
 (9 comments) (1 reaction) (0 assignees)Julia (5,773 forks)batch import
Hacktoberfestgood first issuehashingperformance

Repository metrics

Stars
 (48,709 stars)
PR merge metrics
 (Avg merge 20d 6h) (157 merged PRs in 30d)

Description

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)

Contributor guide