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

use Base.Experimental macros to reduce load time #1147

Closed
wants to merge 1 commit into from

Conversation

mcabbott
Copy link
Member

@mcabbott mcabbott commented Jan 10, 2022

Aims to reduce startup time, xref #1126 . Needs more benchmarking, to see if this slows down other things.

Here's one way to get awful results:

julia> @btime gradient((x,y) -> sum(sqrt.(x./2 .+ y) .- y' .+ 10 .* x.^2), $(rand(100)), $(rand(100)));
  min 6.625 μs, mean 19.931 μs (22 allocations, 167.00 KiB)   # 0.6.33
  min 43.125 μs, mean 56.539 μs (24 allocations, 167.02 KiB)  # PR
  min 131.416 μs, mean 142.481 μs (27 allocations, 167.06 KiB)  # julia -O1, and Zygote 0.6.33

I suspect for this to be useful, you would have to partition the package into sub-modules, only some of which are -O1. It seems quite messy to do that.

@ToucheSir
Copy link
Member

Would isolating just the compiler internals work? i.e. still optimize the code that Zygote generates, but don't optimize the code that does that generation.

@mcabbott
Copy link
Member Author

Yes, that's my hope with the submodule idea -- either put all the internals in Zygote.Slow, or else leave them in Zygote and put the run-time rules in Zygote.Fast. But the code isn't organised to make this division very easy, there are dozens of weird functions which seem to cross the border.

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.

2 participants