Skip to content

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Apr 20, 2025

Compressing IR adds Methods roots, which tend to become quite expensive to store after some time. We also used to store the inferred code, but since we never actually look at that again now (since now the compiler avoids using --output-ji or --sysimage-native-code=no or --pkgimages=no) it is now quite a bit of wasted space also.

Roughly 40 MB saved on disk (165 MB -> 124 MB) if I measured correctly:

usr/lib/julia/sys.so  :
section                    size       addr
.note.gnu.build-id           36        680
.gnu.hash                    52        720
.dynsym                    2760        776
.dynstr                    2070       3536
.gnu.version                230       5606
.gnu.version_r              160       5840
.rela.dyn                943440       6000
.rela.plt                  2256     949440
.init                        27     954368
.plt                       1520     954400
.plt.got                      8     955920
.text                  17207656     955936
.fini                        13   18163592
.rodata                   18388   18165760
.eh_frame_hdr            315940   18184148
.eh_frame               1525972   18500088
.init_array                   8   20032896
.fini_array                   8   20032904
.dynamic                    496   20032912
.got                        128   20033408
.got.plt                    776   20033536
.data                         8   20034312
.bss                          8   20034320
.lbss                     80336   20034336
.lrodata                 303064   20118768
.ldata                123852168   20425928
.comment                     43          0
.debug_info            10028208          0
.debug_abbrev             18197          0
.debug_line             6581659          0
.debug_str               578898          0
.debug_ranges          10854832          0
.debug_gnu_pubnames     3065385          0
.debug_gnu_pubtypes      352332          0
Total                 175737082

Compressing IR adds Methods roots, which tend to become quite expensive
to store after some time. We also used to store the inferred code, but
since we never actually look at that again now (since now the compiler
avoids using --output-ji or --sysimage-native-code=no or --pkgimages=no)
it is now quite a bit of wasted space also.
@vtjnash vtjnash added re-land This relands a PR that was previously merged but was later reverted. merge me PR is reviewed. Merge when all tests are passing labels Apr 21, 2025
@vtjnash vtjnash merged commit f3264e7 into master Apr 22, 2025
8 of 10 checks passed
@vtjnash vtjnash deleted the jn/58078-reland branch April 22, 2025 12:12
@KristofferC
Copy link
Member

KristofferC commented Apr 24, 2025

This caused PackageCompiler to become a lot slower. LinearAlgebra uses it to create a new sysimage with the custom LinearAlgebra in it but that often times out on CI now.

The full time for the LinearAlgebra tests on buildkite is:

Yesterday: macos 27min: https://buildkite.com/julialang/linearalgebra-dot-jl/builds/576#_ (1.13.0-DEV.429)
Two days ago: macos 19 min: https://buildkite.com/julialang/linearalgebra-dot-jl/builds/559 (1.13.0-DEV.424)

Running the sysimage build script locally:

julia> VERSION
v"1.13.0-DEV.425" # a7b8c833a3

julia> @time create_sysimage_linear_algebra();
✔ [02m:21s] PackageCompiler: creating compiler .ji image (incremental=false)
✔ [01m:23s] PackageCompiler: compiling fresh sysimage (incremental=false)
✔ [00m:45s] PackageCompiler: compiling nonincremental system image
307.620009 seconds (1.81 M allocations: 96.583 MiB, 0.03% gc time, 0.13% compilation time: 32% of which was recompilation)

----------

julia> VERSION
v"1.13.0-DEV.426" # f3264e7e3

julia> @time create_sysimage_linear_algebra()
✔ [02m:21s] PackageCompiler: creating compiler .ji image (incremental=false)
✔ [08m:23s] PackageCompiler: compiling fresh sysimage (incremental=false)
✔ [00m:54s] PackageCompiler: compiling nonincremental system image
736.690612 seconds (4.07 M allocations: 253.563 MiB, 0.01% gc time, 0.08% compilation time: 42% of which was recompilation)

This is the command that got slower it seems like:

https://github.com/JuliaLang/PackageCompiler.jl/blob/a32fe6b0843d9967381d0cd48f2628ae84e8c917/src/PackageCompiler.jl#L267-L271

@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Apr 27, 2025
@topolarity
Copy link
Member

This also seems to have made the cmdlineargs test ~4-5x slower (taking up to an hour!)

On the previous PR:

cmdlineargs                                       (5) |   691.43 |   1.32 |  0.2 |     550.58 |  1679.57

versus with this PR:

cmdlineargs                                       (6) |  2747.45 |   0.30 |  0.0 |     461.12 |  1387.00

or the next one:

cmdlineargs                                      (15) |  3562.13 |   0.26 |  0.0 |     343.64 |  1220.98

This is causing CI timeouts, as here: https://buildkite.com/julialang/julia-master/builds/47120#01968dcc-1924-4cc6-8b04-4c07467d2414/902-1447

LebedevRI pushed a commit to LebedevRI/julia that referenced this pull request May 2, 2025
Compressing IR adds Methods roots, which tend to become quite expensive
to store after some time. We also used to store the inferred code, but
since we never actually look at that again now (since now the compiler
avoids using --output-ji or --sysimage-native-code=no or --pkgimages=no)
it is now quite a bit of wasted space also.

Roughly 40 MB saved on disk (165 MB -> 124 MB) if I measured correctly:

```
usr/lib/julia/sys.so  :
section                    size       addr
.note.gnu.build-id           36        680
.gnu.hash                    52        720
.dynsym                    2760        776
.dynstr                    2070       3536
.gnu.version                230       5606
.gnu.version_r              160       5840
.rela.dyn                943440       6000
.rela.plt                  2256     949440
.init                        27     954368
.plt                       1520     954400
.plt.got                      8     955920
.text                  17207656     955936
.fini                        13   18163592
.rodata                   18388   18165760
.eh_frame_hdr            315940   18184148
.eh_frame               1525972   18500088
.init_array                   8   20032896
.fini_array                   8   20032904
.dynamic                    496   20032912
.got                        128   20033408
.got.plt                    776   20033536
.data                         8   20034312
.bss                          8   20034320
.lbss                     80336   20034336
.lrodata                 303064   20118768
.ldata                123852168   20425928
.comment                     43          0
.debug_info            10028208          0
.debug_abbrev             18197          0
.debug_line             6581659          0
.debug_str               578898          0
.debug_ranges          10854832          0
.debug_gnu_pubnames     3065385          0
.debug_gnu_pubtypes      352332          0
Total                 175737082
```
@vtjnash
Copy link
Member Author

vtjnash commented May 2, 2025

Yes, Jeff and I were noticing that recently too, and he planned to deprecate that command line option, or at least remove one of the two tests for it and put the other in a separate file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re-land This relands a PR that was previously merged but was later reverted.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants