The `OBJECT_CACHE` seems to be slower than without it
- Dominant language
- Julia
- Stars
- 117
- Forks
- 19
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 41
Description
Now that we've fixed a bunch of inference failures in the configuration of spaces, I'm wondering how useful the `OBJECT_CACHE` is. From fresh sessions:
##### Main
```julia
julia> using Revise; @time include(joinpath("test", "Spaces", "opt_spaces.jl"))
[ Info: Inference may have improved for SpectralElementSpace1D: (n_found, n_allowed) = (135, 137)
[ Info: Inference may have improved for SpectralElementSpace2D: (n_found, n_allowed) = (284, 287)
[ Info: Inference may have improved for ColumnCenterFiniteDifferenceSpace: (n_found, n_allowed) = (4, 118)
[ Info: Inference may have improved for ColumnFaceFiniteDifferenceSpace: (n_found, n_allowed) = (5, 118)
[ Info: Inference may have improved for SphereSpectralElementSpace: (n_found, n_allowed) = (290, 293)
[ Info: Inference may have improved for CenterExtrudedFiniteDifferenceSpace: (n_found, n_allowed) = (295, 321)
[ Info: Inference may have improved for FaceExtrudedFiniteDifferenceSpace: (n_found, n_allowed) = (295, 321)
[ Info: Inference may have improved for _SpectralElementGrid2D: (n_found, n_allowed) = (0, 12)
Test Summary: | Pass Total Time
Number of JET failures | 9 9 10.6s
20.427916 seconds (57.84 M allocations: 4.156 GiB, 9.20% gc time, 35.98% compilation time: 2% of which was recompilation)
julia> using Revise; @time include(joinpath("test", "Spaces", "opt_spaces.jl"))
WARNING: replacing module TestUtilities.
[ Info: Inference may have improved for SpectralElementSpace1D: (n_found, n_allowed) = (135, 137)
[ Info: Inference may have improved for SpectralElementSpace2D: (n_found, n_allowed) = (284, 287)
[ Info: Inference may have improved for ColumnCenterFiniteDifferenceSpace: (n_found, n_allowed) = (4, 118)
[ Info: Inference may have improved for ColumnFaceFiniteDifferenceSpace: (n_found, n_allowed) = (5, 118)
[ Info: Inference may have improved for SphereSpectralElementSpace: (n_found, n_allowed) = (290, 293)
[ Info: Inference may have improved for CenterExtrudedFiniteDifferenceSpace: (n_found, n_allowed) = (295, 321)
[ Info: Inference may have improved for FaceExtrudedFiniteDifferenceSpace: (n_found, n_allowed) = (295, 321)
[ Info: Inference may have improved for _SpectralElementGrid2D: (n_found, n_allowed) = (0, 12)
Test Summary: | Pass Total Time
Number of JET failures | 9 9 0.7s
0.754967 seconds (3.54 M allocations: 245.710 MiB, 17.76% gc time, 24.16% compilation time)
```
##### Removed `get!(Cache.OBJECT_CACHE`
```julia
julia> using Revise; @time include(joinpath("test", "Spaces", "opt_spaces.jl"))
[ Info: Inference may have improved for SpectralElementSpace1D: (n_found, n_allowed) = (0, 137)
[ Info: Inference may have improved for SpectralElementSpace2D: (n_found, n_allowed) = (99, 287)
[ Info: Inference may have improved for ColumnCenterFiniteDifferenceSpace: (n_found, n_allowed) = (0, 118)
[ Info: Inference may have improved for ColumnFaceFiniteDifferenceSpace: (n_found, n_allowed) = (0, 118)
[ Info: Inference may have improved for SphereSpectralElementSpace: (n_found, n_allowed) = (12, 293)
[ Info: Inference may have improved for CenterExtrudedFiniteDifferenceSpace: (n_found, n_allowed) = (12, 321)
[ Info: Inference may have improved for FaceExtrudedFiniteDifferenceSpace: (n_found, n_allowed) = (12, 321)
[ Info: Inference may have improved for _SpectralElementGrid2D: (n_found, n_allowed) = (0, 12)
Test Summary: | Pass Total Time
Number of JET failures | 9 9 11.0s
12.654057 seconds (69.27 M allocations: 4.786 GiB, 13.23% gc time, 44.82% compilation time: 3% of which was recompilation)
julia> using Revise; @time include(joinpath("test", "Spaces", "opt_spaces.jl"))
WARNING: replacing module TestUtilities.
[ Info: Inference may have improved for SpectralElementSpace1D: (n_found, n_allowed) = (0, 137)
[ Info: Inference may have improved for SpectralElementSpace2D: (n_found, n_allowed) = (99, 287)
[ Info: Inference may have improved for ColumnCenterFiniteDifferenceSpace: (n_found, n_allowed) = (0, 118)
[ Info: Inference may have improved for ColumnFaceFiniteDifferenceSpace: (n_found, n_allowed) = (0, 118)
[ Info: Inference may have improved for SphereSpectralElementSpace: (n_found, n_allowed) = (12, 293)
[ Info: Inference may have improved for CenterExtrudedFiniteDifferenceSpace: (n_found, n_allowed) = (12, 321)
[ Info: Inference may have improved for FaceExtrudedFiniteDifferenceSpace: (n_found, n_allowed) = (12, 321)
[ Info: Inference may have improved for _SpectralElementGrid2D: (n_found, n_allowed) = (0, 12)
Test Summary: | Pass Total Time
Number of JET failures | 9 9 0.6s
0.655213 seconds (3.67 M allocations: 257.794 MiB, 29.11% compilation time)
```
cc @Sbozzolo, @dennisYatunin, @sriharshakandala
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with test/Spaces/opt_spaces.jl and locate the get!(Cache.OBJECT_CACHE) calls involved in the benchmark. Run the shown fresh and repeated @time include measurements with and without the cache, then identify and report whether the cache behavior explains the performance difference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100