Skip to content

Fixes #432 ... #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 14, 2022
Merged

Fixes #432 ... #504

merged 12 commits into from
Mar 14, 2022

Conversation

goerch
Copy link
Contributor

@goerch goerch commented Dec 8, 2021

... by moving invokelatest up the call stack.

... by moving `invokelatest` up the call stack.
@pfitzseb
Copy link
Member

pfitzseb commented Dec 8, 2021

Why does this work? And how much of a performance impact does it have?

@goerch
Copy link
Contributor Author

goerch commented Dec 8, 2021

Why does this work?

I first tried smaller changes to repair the problem, but then some tests failed. I don't have tools available to diagnose the crash in Julia.

And how much of a performance impact does it have?

Doesn't CI tell us that?

@codecov
Copy link

codecov bot commented Dec 8, 2021

Codecov Report

Merging #504 (735c3fc) into master (2030a00) will decrease coverage by 0.03%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #504      +/-   ##
==========================================
- Coverage   87.31%   87.28%   -0.04%     
==========================================
  Files          12       12              
  Lines        2468     2470       +2     
==========================================
+ Hits         2155     2156       +1     
- Misses        313      314       +1     
Impacted Files Coverage Δ
src/interpret.jl 81.08% <66.66%> (-0.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2030a00...735c3fc. Read the comment docs.

@goerch
Copy link
Contributor Author

goerch commented Dec 8, 2021

Ouch. Any hints how to repair this for Julia 1?

@pfitzseb
Copy link
Member

pfitzseb commented Dec 8, 2021

Wait for #499 to be merged and rebase :)

src/interpret.jl Outdated
Comment on lines 176 to 202
fmod = parentmodule(f)::Module
if fmod === JuliaInterpreter.CompiledCalls || fmod === Core.Compiler
return Some{Any}(Base.invokelatest(f, fargs[2:end]...))
else
return Some{Any}(f(fargs[2:end]...))
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we want to keep this code around (like with commented out), and leave some comment that says ideally we want to figure out the root problem here and remove the added invokelatest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@timholy
Copy link
Member

timholy commented Dec 13, 2021

I worry this isn't the right fix...it's just kind of a bandaid, and one that will likely hurt performance.

And how much of a performance impact does it have?

Doesn't CI tell us that?

No, CI is often quite bad for checking performance, because the CI servers are always running multiple tasks and you get spurious failures when server-latency gets confounded for a performance regression. You kind of need a dedicated machine.

You can run benchmarks locally in https://github.com/JuliaDebug/JuliaInterpreter.jl/tree/master/benchmark, although as a caution our benchmarks may not be completely thorough.

@pfitzseb
Copy link
Member

I worry this isn't the right fix...it's just kind of a bandaid, and one that will likely hurt performance.

Same, which is why I'd like to understand why this works.
That said, invokelatest performance got much better recently, I think.

@goerch
Copy link
Contributor Author

goerch commented Dec 13, 2021

You can run benchmarks locally in https://github.com/JuliaDebug/JuliaInterpreter.jl/tree/master/benchmark, although as a caution our benchmarks may not be completely thorough.

For main:

Benchmarkresults:
    Package: JuliaInterpreter
    Date: 13 Dec 2021 - 13:34
    Package commit: dirty
    Julia commit: 3bf9d1
    BenchmarkGroup:
        7-element BenchmarkTools.BenchmarkGroup:
          tags: []
          "recursive other 1_000" => Trial(6.007 ms)
          "recursive self 1_000" => Trial(2.848 ms)
          "ccall library" => Trial(82.300 μs)
          "ccall ptr" => Trial(19.900 μs)
          "long function 5_000" => Trial(21.305 ms)
          "throw long 1_000" => Trial(6.804 ms)
          "tight loop 10_000" => Trial(221.751 ms)

For branch:

Benchmarkresults:
    Package: JuliaInterpreter
    Date: 13 Dec 2021 - 13:40
    Package commit: 7c156d
    Julia commit: 3bf9d1
    BenchmarkGroup:
        7-element BenchmarkTools.BenchmarkGroup:
          tags: []
          "recursive other 1_000" => Trial(5.827 ms)
          "recursive self 1_000" => Trial(3.056 ms)
          "ccall library" => Trial(80.000 μs)
          "ccall ptr" => Trial(18.100 μs)
          "long function 5_000" => Trial(21.651 ms)
          "throw long 1_000" => Trial(6.737 ms)
          "tight loop 10_000" => Trial(233.557 ms)

@goerch
Copy link
Contributor Author

goerch commented Jan 1, 2022

Why does this work?

At least I now understand that there seems to be some kind of world age confusion. Interesting question I've been pondering is how to explicitly track world age.

@KristofferC KristofferC reopened this Mar 14, 2022
@KristofferC
Copy link
Member

KristofferC commented Mar 14, 2022

Let's get this in even though we are not sure exactly what is going on. It fixes a problem and doesn't complicate the code much. Thanks @goerch!

@KristofferC KristofferC merged commit dd67487 into JuliaDebug:master Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants