File tree 1 file changed +16
-5
lines changed
src/tools/rust-installer/src
1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -61,13 +61,24 @@ impl CompressionFormat {
61
61
lzma_ops. literal_context_bits ( 3 ) ;
62
62
63
63
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
+
64
79
let compressor = XzEncoder :: new_stream (
65
80
std:: io:: BufWriter :: new ( file) ,
66
- xz2:: stream:: MtStreamBuilder :: new ( )
67
- . threads ( 1 )
68
- . filters ( filters)
69
- . encoder ( )
70
- . unwrap ( ) ,
81
+ builder. encoder ( ) . unwrap ( ) ,
71
82
) ;
72
83
Box :: new ( compressor)
73
84
}
You can’t perform that action at this time.
0 commit comments