File tree Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Expand file tree Collapse file tree 2 files changed +21
-17
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 7f05f088c7e47442e6fee4bfc519227b814b39a4
2
+ refs/heads/master: 5a4e2ae70660d5e23e04f7dbb6c1b1ab3c9dd0b0
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
5
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ fn pbfs(graph: graph, key: node_id) -> bfs_result {
261
261
}
262
262
} ;
263
263
264
+ #[ inline( always) ]
264
265
fn is_gray ( c : color ) -> bool {
265
266
alt c {
266
267
gray( _) { true }
@@ -274,25 +275,28 @@ fn pbfs(graph: graph, key: node_id) -> bfs_result {
274
275
log ( info, #fmt ( "PBFS iteration %?" , i) ) ;
275
276
i += 1 u;
276
277
let old_len = colors. len ( ) ;
277
- colors = par:: mapi ( colors) { |i, c, copy colors|
278
+ let pc = ptr:: addr_of ( colors) ;
279
+ let pg = ptr:: addr_of ( graph) ;
280
+ colors = par:: mapi ( colors) { |i, c|
278
281
let c : color = c;
279
282
alt c {
280
283
white {
281
- let i = i as node_id ;
282
-
283
- let neighbors = graph[ i] ;
284
-
285
- let mut color = white;
286
-
287
- neighbors. each ( ) { |k|
288
- if is_gray ( colors[ k] ) {
289
- color = gray ( k) ;
290
- false
291
- }
292
- else { true }
293
- } ;
294
-
295
- color
284
+ unsafe {
285
+ let i = i as node_id ;
286
+
287
+ let neighbors = & ( * pg) [ i] ;
288
+
289
+ let mut color = white;
290
+
291
+ ( * neighbors) . each ( ) { |k|
292
+ if is_gray ( ( * pc) [ k] ) {
293
+ color = gray ( k) ;
294
+ false
295
+ }
296
+ else { true }
297
+ } ;
298
+ color
299
+ }
296
300
}
297
301
gray ( parent) { black ( parent) }
298
302
black ( parent) { black ( parent) }
You can’t perform that action at this time.
0 commit comments