Skip to content

Commit ee78b1f

Browse files
committed
Reduce the dynamic allocations in acyclic coloring
1 parent e7893c1 commit ee78b1f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/coloring.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ function acyclic_coloring(g::AdjacencyGraph, order::AbstractOrder; postprocessin
302302
first_neighbor = fill((0, 0), nv) # at first no neighbors have been encountered
303303
first_visit_to_tree = fill((0, 0), ne)
304304
forest = DisjointSets{Tuple{Int,Int}}()
305+
sizehint!(forest.intmap, ne)
306+
sizehint!(forest.revmap, ne)
307+
sizehint!(forest.internal.parents, ne)
308+
sizehint!(forest.internal.ranks, ne)
305309
vertices_in_order = vertices(g, order)
306310

307311
for v in vertices_in_order

0 commit comments

Comments
 (0)