File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
src/tools/rust-installer/src Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -61,13 +61,24 @@ impl CompressionFormat {
6161 lzma_ops. literal_context_bits ( 3 ) ;
6262
6363 filters. lzma2 ( & lzma_ops) ;
64+
65+ let mut builder = xz2:: stream:: MtStreamBuilder :: new ( ) ;
66+ builder. filters ( filters) ;
67+
68+ // On 32-bit platforms limit ourselves to 3 threads, otherwise we exceed memory
69+ // usage this process can take. In the future we'll likely only do super-fast
70+ // compression in CI and move this heavyweight processing to promote-release (which
71+ // is always 64-bit and can run on big-memory machines) but for now this lets us
72+ // move forward.
73+ if std:: mem:: size_of :: < usize > ( ) == 4 {
74+ builder. threads ( 3 ) ;
75+ } else {
76+ builder. threads ( 6 ) ;
77+ }
78+
6479 let compressor = XzEncoder :: new_stream (
6580 std:: io:: BufWriter :: new ( file) ,
66- xz2:: stream:: MtStreamBuilder :: new ( )
67- . threads ( 1 )
68- . filters ( filters)
69- . encoder ( )
70- . unwrap ( ) ,
81+ builder. encoder ( ) . unwrap ( ) ,
7182 ) ;
7283 Box :: new ( compressor)
7384 }
You can’t perform that action at this time.
0 commit comments