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

Faster startup/smaller sysimg, excising Pkg (for now) #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PallHaraldsson
Copy link
Owner

@PallHaraldsson PallHaraldsson commented Aug 9, 2023

See: JuliaLang#50833 (comment)

It's 22% faster startup because the sysimage is 33% smaller.

With a minor breaking change it would be 30.2% faster and 37.5% smaller.

@PallHaraldsson
Copy link
Owner Author

PallHaraldsson commented Aug 25, 2023

@JeffBezanson My PR doesn't seem to be considered (maybe because it's not in JuliaLang's PR list, and I'm actually not sure why it appeared here, all my previous PRs didn't, I use the GitHub editor).

Well, except you mentioned in total time would be higher, i.e. eaten up when you actually use functionality not loaded here/at startup. But I'm not convinced. Code in pkgimages is serialized to machine code too by now, and if/assuming the same code is compiled just elsewhere then should be as fast to load later. Besides some of the code might actually never be needed.

I would like using to work in parallel (at some point), I can at least see it conceivable that (maybe just one) using would be done in parallel with other code running.

I think we should just merge this to master, and see if any benchmark actually shows slowdown.

ViralBShah pushed a commit that referenced this pull request Nov 2, 2023
This commit improves SROA pass by extending the `unswitchtupleunion`
optimization to handle the general parametric types, e.g.:
```julia
julia> struct A{T}
           x::T
       end;

julia> function foo(a1, a2, c)
           t = c ? A(a1) : A(a2)
           return getfield(t, :x)
       end;

julia> only(Base.code_ircode(foo, (Int,Float64,Bool); optimize_until="SROA"))
```

> Before
```
2 1 ─      goto #3 if not _4                                          │
  2 ─ %2 = %new(A{Int64}, _2)::A{Int64}                               │╻ A
  └──      goto #4                                                    │
  3 ─ %4 = %new(A{Float64}, _3)::A{Float64}                           │╻ A
  4 ┄ %5 = φ (#2 => %2, #3 => %4)::Union{A{Float64}, A{Int64}}        │
3 │   %6 = Main.getfield(%5, :x)::Union{Float64, Int64}               │
  └──      return %6                                                  │
   => Union{Float64, Int64}
```

> After
```
julia> only(Base.code_ircode(foo, (Int,Float64,Bool); optimize_until="SROA"))
2 1 ─      goto #3 if not _4                                           │
  2 ─      nothing::A{Int64}                                           │╻ A
  └──      goto #4                                                     │
  3 ─      nothing::A{Float64}                                         │╻ A
  4 ┄ %8 = φ (#2 => _2, #3 => _3)::Union{Float64, Int64}               │
  │        nothing::Union{A{Float64}, A{Int64}}
3 │   %6 = %8::Union{Float64, Int64}                                   │
  └──      return %6                                                   │
   => Union{Float64, Int64}
```
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.

1 participant