Skip to content
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

subtypes is extremely slow #193

Closed
fredrikekre opened this issue Mar 20, 2019 · 5 comments
Closed

subtypes is extremely slow #193

fredrikekre opened this issue Mar 20, 2019 · 5 comments

Comments

@fredrikekre
Copy link
Contributor

julia> using JuliaInterpreter
       f() = subtypes(Integer)
       @time f()
       @time @interpret f()
  0.027871 seconds (2.32 k allocations: 669.202 KiB)
1204.521373 seconds (408.38 M allocations: 20.456 GiB, 0.30% gc time)
3-element Array{Any,1}:
 Bool    
 Signed  
 Unsigned
@fredrikekre
Copy link
Contributor Author

The reason I ran into this is that Documenter uses subtypes to determine ordering of build steps etc. However, if you push subtypes to compiled_methods it is possible to interpret through a Documenter build without any problems, so thats a good thing!

@pfitzseb
Copy link
Member

Maybe it would make sense to allow the user to push certain functions (or whole modules) into that list as a short term solution until something like #204 improves performance.

That way you could e.g. say that you don't care about what's going on in Base and only interpret user side code. The obvious downside is that higher order functions would be super intransparent, but maybe that's worth it.

@timholy
Copy link
Member

timholy commented Mar 21, 2019

allow the user to push certain functions

That's already possible:

help?> JuliaInterpreter.compiled_methods
  meth  compiled_methods indicates that meth should be run using Compiled rather than recursed into via the interpreter.

But perhaps we should push both methods of subtypes in set_compiled_methods; there's probably not a lot of profit in stepping through them. And users can always delete! entries if they really know what they are doing.

@KristofferC
Copy link
Member

KristofferC commented Mar 31, 2019

julia> @time @interpret f()
 15.458208 seconds (129.43 M allocations: 4.091 GiB, 2.23% gc time)
3-element Array{Any,1}:
 Bool
 Signed
 Unsigned

now (of course with removing the subtypes from the compiled method set).

Still kinda slow but managed to claw back an 80x improvement

@KristofferC
Copy link
Member

I don't feel there is anything particularly slow with this specific function here anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants