@@ -67,11 +67,7 @@ pub fn estimate_hours(
67
67
}
68
68
}
69
69
70
- type CommitChangeLineCounters = (
71
- Option < Arc < AtomicUsize > > ,
72
- Option < Arc < AtomicUsize > > ,
73
- Option < Arc < AtomicUsize > > ,
74
- ) ;
70
+ type CommitChangeLineCounters = ( Arc < AtomicUsize > , Arc < AtomicUsize > , Arc < AtomicUsize > ) ;
75
71
76
72
type SpawnResultWithReturnChannelAndWorkers < ' scope > = (
77
73
crossbeam_channel:: Sender < Vec < ( CommitIdx , Option < gix:: hash:: ObjectId > , gix:: hash:: ObjectId ) > > ,
@@ -95,7 +91,7 @@ pub fn spawn_tree_delta_threads<'scope>(
95
91
let rx = rx. clone ( ) ;
96
92
move || -> Result < _ , anyhow:: Error > {
97
93
let mut out = Vec :: new ( ) ;
98
- let ( commit_counter , change_counter , lines_counter ) = stats_counters;
94
+ let ( commits , changes , lines_count ) = stats_counters;
99
95
let mut attributes = line_stats
100
96
. then ( || -> anyhow:: Result < _ > {
101
97
repo. index_or_load_from_head ( ) . map_err ( Into :: into) . and_then ( |index| {
@@ -115,9 +111,7 @@ pub fn spawn_tree_delta_threads<'scope>(
115
111
. transpose ( ) ?;
116
112
for chunk in rx {
117
113
for ( commit_idx, parent_commit, commit) in chunk {
118
- if let Some ( c) = commit_counter. as_ref ( ) {
119
- c. fetch_add ( 1 , Ordering :: SeqCst ) ;
120
- }
114
+ commits. fetch_add ( 1 , Ordering :: Relaxed ) ;
121
115
if gix:: interrupt:: is_triggered ( ) {
122
116
return Ok ( out) ;
123
117
}
@@ -139,23 +133,21 @@ pub fn spawn_tree_delta_threads<'scope>(
139
133
. track_rewrites ( None )
140
134
. for_each_to_obtain_tree ( & to, |change| {
141
135
use gix:: object:: tree:: diff:: change:: Event :: * ;
142
- if let Some ( c) = change_counter. as_ref ( ) {
143
- c. fetch_add ( 1 , Ordering :: SeqCst ) ;
144
- }
136
+ changes. fetch_add ( 1 , Ordering :: Relaxed ) ;
145
137
match change. event {
146
138
Rewrite { .. } => {
147
139
unreachable ! ( "we turned that off" )
148
140
}
149
141
Addition { entry_mode, id } => {
150
142
if entry_mode. is_no_tree ( ) {
151
143
files. added += 1 ;
152
- add_lines ( line_stats, lines_counter . as_deref ( ) , & mut lines, id) ;
144
+ add_lines ( line_stats, & lines_count , & mut lines, id) ;
153
145
}
154
146
}
155
147
Deletion { entry_mode, id } => {
156
148
if entry_mode. is_no_tree ( ) {
157
149
files. removed += 1 ;
158
- remove_lines ( line_stats, lines_counter . as_deref ( ) , & mut lines, id) ;
150
+ remove_lines ( line_stats, & lines_count , & mut lines, id) ;
159
151
}
160
152
}
161
153
Modification {
@@ -168,16 +160,11 @@ pub fn spawn_tree_delta_threads<'scope>(
168
160
( false , false ) => { }
169
161
( false , true ) => {
170
162
files. added += 1 ;
171
- add_lines ( line_stats, lines_counter . as_deref ( ) , & mut lines, id) ;
163
+ add_lines ( line_stats, & lines_count , & mut lines, id) ;
172
164
}
173
165
( true , false ) => {
174
166
files. removed += 1 ;
175
- remove_lines (
176
- line_stats,
177
- lines_counter. as_deref ( ) ,
178
- & mut lines,
179
- previous_id,
180
- ) ;
167
+ remove_lines ( line_stats, & lines_count, & mut lines, previous_id) ;
181
168
}
182
169
( true , true ) => {
183
170
files. modified += 1 ;
@@ -203,9 +190,7 @@ pub fn spawn_tree_delta_threads<'scope>(
203
190
nl += counts. insertions as usize + counts. removals as usize ;
204
191
lines. added += counts. insertions as usize ;
205
192
lines. removed += counts. removals as usize ;
206
- if let Some ( c) = lines_counter. as_ref ( ) {
207
- c. fetch_add ( nl, Ordering :: SeqCst ) ;
208
- }
193
+ lines_count. fetch_add ( nl, Ordering :: Relaxed ) ;
209
194
}
210
195
}
211
196
}
0 commit comments