pyjulia slower than expected for some operations
See original GitHub issueI’ve been using pyjulia to wrap a julia package, but the wrapper seems slower than I would expect. The pyjulia code using diffeqpy involves some setup to generate the react object which has a julia ODEProblem with a julia function attached, but the main operation is a solve like this:
sol = de.solve(react.ode,de.CVODE_BDF(),abstol=1e-16,reltol=1e-6)
In pure julia at first evaluation this takes about 20 seconds, and after that it takes about 6 seconds In pyjulia at first evaluation this takes about 30 seconds and after that it takes about 18 seconds.
I get the same result if I interface directly with DifferentialEquations without diffeqpy.
I can’t think of any reason it should be that different. Does some of the jit compilation have to happen every evaluation in pyjulia? I’m using the python-jl fix if that affects things.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)

Top Related StackOverflow Question
If you use PyJulia for passing around Julia functions and values, it should be as fast as pure Julia solution (if the main computation is done in Julia). My guess is that there are some quirks in how PyCall wrap/unwrap things (or usage of it) and the ODE solver accidentally calls Julia functions via Python. I’d run Julia profiler to see if/where PyCall shows up in the hot loop.
It looks like the difference has really dropped. It could’ve been a WSL problem before.
vs
That last amount could just be simple setup stuff, so this can be closed.