File tree 3 files changed +63
-6
lines changed
3 files changed +63
-6
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,44 @@ Types of changes
44
44
1.07x faster,
45
45
from 2m44s to 2m33s
46
46
47
+ - After profiling the code as suggested by
48
+ [ nnethercote's perf-book] ( https://nnethercote.github.io/perf-book/profiling.html )
49
+ one critical path of Alejandra was identified an optimized,
50
+ yielding huge performance boosts:
51
+
52
+ - x86_64-unknown-linux-gnu, 2.5x faster,
53
+ from 0m8.381s to 0m3.410s
54
+
55
+ - x86_64-unknown-linux-musl, 2.3x faster,
56
+ from 0m9.642s to 0m4.134s
57
+
58
+ - [ On QEMU] ( https://www.qemu.org/ ) aarch64-unknown-linux-musl,
59
+ 2.4x faster,
60
+ from 1m10s to 0m29s
61
+
62
+ - [ On QEMU] ( https://www.qemu.org/ ) armv6l-unknown-linux-musleabihf,
63
+ 1.85x faster,
64
+ from 7m41s to 4m8.399s
65
+
66
+ - [ On QEMU] ( https://www.qemu.org/ ) armv7l-unknown-linux-musleabihf,
67
+ 1.88x faster,
68
+ from 5m7s to 2m42.595s
69
+
70
+ - [ On QEMU] ( https://www.qemu.org/ ) i686-unknown-linux-musl,
71
+ 1.65x faster,
72
+ from 2m33s to 1m32.671s
73
+
74
+ In general this is an algorithmic improvement
75
+ and therefore the following platforms should be faster as well
76
+ by a similar ratio
77
+ (not measured):
78
+
79
+ - aarch64-apple-darwin
80
+ - x86_64-apple-darwin
81
+
82
+ - A ` --threads ` flag, so you can pick how many formatting threads to spawn.
83
+ Defaults to the number of logical CPUs in your system.
84
+
47
85
## [ 0.6.0] - 2022-02-25
48
86
49
87
### Added
Original file line number Diff line number Diff line change @@ -207,11 +207,11 @@ Please see: [CHANGELOG.md](./CHANGELOG.md).
207
207
208
208
| Logical Cores | Seconds |
209
209
| :-----------: | :-----: |
210
- | 1 | 35 |
211
- | 2 | 18 |
212
- | 4 | 10 |
213
- | 8 | 10 |
214
- | 16 | 10 |
210
+ | 1 | 15.1 |
211
+ | 2 | 7.9 |
212
+ | 4 | 5.4 |
213
+ | 8 | 4.1 |
214
+ | 16 | 3.6 |
215
215
216
216
[ ^ semantic-changes ] : The methodology to claim this is:
217
217
Original file line number Diff line number Diff line change @@ -24,7 +24,19 @@ pub(crate) fn parse(args: Vec<String>) -> clap::ArgMatches {
24
24
. arg (
25
25
clap:: Arg :: new ( "check" )
26
26
. help ( "Check if the input is already formatted." )
27
- . long ( "--check" ) ,
27
+ . long ( "--check" )
28
+ . short ( 'c' ) ,
29
+ )
30
+ . arg (
31
+ clap:: Arg :: new ( "threads" )
32
+ . default_value ( "0" )
33
+ . help (
34
+ "Number of formatting threads to spawn. Defaults to the \
35
+ number of logical CPUs.",
36
+ )
37
+ . long ( "--threads" )
38
+ . short ( 't' )
39
+ . takes_value ( true ) ,
28
40
)
29
41
. term_width ( 80 )
30
42
. after_help ( indoc:: indoc!(
@@ -310,6 +322,13 @@ pub fn main() -> std::io::Result<()> {
310
322
let matches = crate :: cli:: parse ( std:: env:: args ( ) . collect ( ) ) ;
311
323
312
324
let check = matches. is_present ( "check" ) ;
325
+ let threads = matches. value_of ( "threads" ) . unwrap ( ) ;
326
+ let threads: usize = threads. parse ( ) . unwrap ( ) ;
327
+
328
+ rayon:: ThreadPoolBuilder :: new ( )
329
+ . num_threads ( threads)
330
+ . build_global ( )
331
+ . unwrap ( ) ;
313
332
314
333
let formatted_paths = match matches. values_of ( "include" ) {
315
334
Some ( include) => {
You can’t perform that action at this time.
0 commit comments