state-res: Refactor lexicographical_topological_sort

Gets rid of unnecessary copying and makes things more explicit by using
a struct with named fields instead of a tuple for tie breaking.

Co-authored-by: Jonathan de Jong <jonathan@automatia.nl>
This commit is contained in:
Jonas Platte
2021-11-26 16:07:30 +01:00
parent 6c48926649
commit 9ed75241a6
4 changed files with 37 additions and 22 deletions

View File

@@ -48,8 +48,8 @@ fn lexico_topo_sort(c: &mut Criterion) {
event_id("p") => hashset![event_id("o")],
};
b.iter(|| {
let _ = state_res::lexicographical_topological_sort(&graph, |id| {
Ok((int!(0), MilliSecondsSinceUnixEpoch(uint!(0)), id.to_owned()))
let _ = state_res::lexicographical_topological_sort(&graph, |_id| {
Ok((int!(0), MilliSecondsSinceUnixEpoch(uint!(0))))
});
})
});