Skip to content

Oscillations in performance after different precompilation runs #51988

Open
@Tortar

Description

@Tortar

When trying to optimize the Julia code for the benchmark at https://github.com/jinyus/related_post_gen we realized that results for the Julia code varied much more that for other languages, for more on this see https://discourse.julialang.org/t/funny-benchmark-with-julia-no-longer-at-the-bottom/104611/141. When trying on my machine I found the same. I retried on another one and I reproduced it, so I came to the conclusion that something is strange.

The procedure to reproduce this behaviour is:

  1. Run git clone https://github.com/Tortar/related_post_gen.git
  2. Run julia -e 'using Pkg; Pkg.develop(path="./related_post_gen/julia/Related")'
  3. Run julia -e "using Related; for _ in 1:10 main() end"
  4. Mimic a change in the source code so that to trigger again precompilation on the next run (e.g. I added a space somewhere)
  5. Run julia -e "using Related; for _ in 1:10 main() end"
  6. If necessary, repeat 4. and 5. a few times to be able to reproduce

This is what I see on my computer:

bob@bob-Victus-by-HP-Gaming-Laptop-15-fb0xxx:~/related_post_gen/julia$ julia -e "using Related; for _ in 1:10 main() end"
Processing time (w/o IO): 305 milliseconds
Processing time (w/o IO): 25 milliseconds
Processing time (w/o IO): 26 milliseconds
Processing time (w/o IO): 26 milliseconds
Processing time (w/o IO): 26 milliseconds
Processing time (w/o IO): 25 milliseconds
Processing time (w/o IO): 24 milliseconds
Processing time (w/o IO): 26 milliseconds
Processing time (w/o IO): 25 milliseconds
Processing time (w/o IO): 25 milliseconds
Processing time (w/o IO): 25 milliseconds

# this will retrigger precompilation as specified above
bob@bob-Victus-by-HP-Gaming-Laptop-15-fb0xxx:~/related_post_gen/julia$ julia -e "using Related; for _ in 1:10 main() end"
Processing time (w/o IO): 294 milliseconds
Processing time (w/o IO): 18 milliseconds
Processing time (w/o IO): 18 milliseconds
Processing time (w/o IO): 19 milliseconds
Processing time (w/o IO): 18 milliseconds
Processing time (w/o IO): 18 milliseconds
Processing time (w/o IO): 18 milliseconds
Processing time (w/o IO): 18 milliseconds
Processing time (w/o IO): 18 milliseconds
Processing time (w/o IO): 18 milliseconds
Processing time (w/o IO): 18 milliseconds

As you can see there is a variation of nearly 40% in performance. Notice that the algorithm of the Related source file is deterministic.

Version infos for the two computers where I reproduced this behaviour:

Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × AMD Ryzen 5 5600H with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
  Threads: 1 on 12 virtual cores
-----------------------------------------------------------
Julia Version 1.9.3
Commit bed2cd540a (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 6 × Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 1 on 6 virtual cores

Apart from the (maybe) recoverable performance that solving this issue can get, I want to stress that these oscillations create difficulties in optimizing the code in a time efficient way since one can be misleaded by these oscillations.

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