Skip to content

Do not allocate so many arrays in optimizer hot path #44492

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 1 commit into from
Mar 8, 2022

Conversation

Keno
Copy link
Member

@Keno Keno commented Mar 7, 2022

Before:

julia> @time Cthulhu.mkinterp(TortureTest.run_test1, Tuple{Int});
 12.851312 seconds (89.76 M allocations: 12.845 GiB, 39.38% gc time)

julia> @time Cthulhu.mkinterp(TortureTest.run_test1, Tuple{Int});
 10.862736 seconds (89.76 M allocations: 12.845 GiB, 26.90% gc time)

After:

julia> @time Cthulhu.mkinterp(TortureTest.run_test1, Tuple{Int});
 10.929275 seconds (59.01 M allocations: 10.987 GiB, 33.07% gc time)

julia> @time Cthulhu.mkinterp(TortureTest.run_test1, Tuple{Int});
  8.635190 seconds (59.01 M allocations: 10.987 GiB, 20.06% gc time)

Before:
```
julia> @time Cthulhu.mkinterp(TortureTest.run_test1, Tuple{Int});
 12.851312 seconds (89.76 M allocations: 12.845 GiB, 39.38% gc time)

julia> @time Cthulhu.mkinterp(TortureTest.run_test1, Tuple{Int});
 10.862736 seconds (89.76 M allocations: 12.845 GiB, 26.90% gc time)
```

After:
```
julia> @time Cthulhu.mkinterp(TortureTest.run_test1, Tuple{Int});
 10.929275 seconds (59.01 M allocations: 10.987 GiB, 33.07% gc time)

julia> @time Cthulhu.mkinterp(TortureTest.run_test1, Tuple{Int});
  8.635190 seconds (59.01 M allocations: 10.987 GiB, 20.06% gc time)
```
Keno added a commit that referenced this pull request Mar 7, 2022
With #44494, this cuts about 22M allocations (out of 59M) from the
compiler benchmark in #44492. Without #44494, it still reduces
the number of allocations, but not as much. This was originally
optimized in 100666b, but the
behavior of our compiler has changed to allow inling the Tuple{UseRef, Int}
into the outer struct, forcing a reallocation on every iteration.
@aviatesk
Copy link
Member

aviatesk commented Mar 7, 2022

@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - no performance regressions were detected. A full report can be found here.

@oscardssmith oscardssmith added the latency Latency label Mar 7, 2022
@oscardssmith oscardssmith merged commit dc45d77 into master Mar 8, 2022
@oscardssmith oscardssmith deleted the kf/filterit branch March 8, 2022 00:23
ianatol pushed a commit to ianatol/julia that referenced this pull request Mar 15, 2022
With JuliaLang#44494, this cuts about 22M allocations (out of 59M) from the
compiler benchmark in JuliaLang#44492. Without JuliaLang#44494, it still reduces
the number of allocations, but not as much. This was originally
optimized in 100666b, but the
behavior of our compiler has changed to allow inling the Tuple{UseRef, Int}
into the outer struct, forcing a reallocation on every iteration.
Keno added a commit that referenced this pull request Mar 15, 2022
With #44494, this cuts about 22M allocations (out of 59M) from the
compiler benchmark in #44492. Without #44494, it still reduces
the number of allocations, but not as much. This was originally
optimized in 100666b, but the
behavior of our compiler has changed to allow inling the Tuple{UseRef, Int}
into the outer struct, forcing a reallocation on every iteration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
latency Latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants