Skip to content

Commit d54c752

Browse files
committed
Dos fixes and inlines
1 parent 992a520 commit d54c752

9 files changed

Lines changed: 15 additions & 7 deletions

File tree

webgraph/CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
- Support for π codes, both in the file format and in the CLI tools.
1515

1616
- `SequentialLabeling::build_dcf` new default method for building a degree
17-
cumulative function. It is overridden by more efficient methods, for example,
18-
in `BvGraphSeq`. All iterators have fast constant-time implementations of
19-
`count` whenever possible to support the method.
17+
cumulative function. It is overridden by more efficient implementations, for
18+
example, in `BvGraphSeq`. All iterators have fast constant-time
19+
implementations of `count` whenever possible to support the method.
2020

2121
### Changed
2222

webgraph/src/graphs/btree_graph.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ impl<L: Clone + 'static> Iterator for LabeledSucc<'_, L> {
398398
self.0.next().map(|(succ, labels)| (*succ, labels.clone()))
399399
}
400400

401+
#[inline(always)]
401402
fn count(self) -> usize {
402403
self.len()
403404
}
@@ -423,6 +424,7 @@ impl Iterator for Succ<'_> {
423424
self.0.next()
424425
}
425426

427+
#[inline(always)]
426428
fn count(self) -> usize {
427429
self.len()
428430
}

webgraph/src/graphs/bvgraph/masked_iter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ impl<I: Iterator<Item = usize>> Iterator for MaskedIter<I> {
9797
result
9898
}
9999

100+
#[inline(always)]
100101
fn count(self) -> usize {
101102
self.len()
102103
}

webgraph/src/graphs/bvgraph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl<T: for<'a> DeserInner<DeserType<'a>: IndexedSeq<Input = usize, Output<'a> =
197197

198198
/// The default type we use for the cumulative function of degrees.
199199
///
200-
/// It provides an indexed dictionary](sux::traits::indexed_dict::IndexedDict) with
200+
/// It provides an [indexed dictionary](sux::traits::indexed_dict::IndexedDict) with
201201
/// [successor](sux::traits::indexed_dict::Succ) and [predecessor](sux::traits::indexed_dict::Pred) support.
202202
///
203203
/// This is the type returned by [`crate::traits::labels::SequentialLabeling::build_dcf`].

webgraph/src/graphs/bvgraph/random_access.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ impl<D: Decode> Iterator for Succ<D> {
479479
Some(min)
480480
}
481481

482+
#[inline(always)]
482483
fn count(self) -> usize {
483484
self.len()
484485
}

webgraph/src/graphs/permuted_graph.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ impl<I: Iterator<Item = usize>, P: SliceByValue<Value = usize>> Iterator for Suc
163163
self.iter.next().map(|succ| self.perm.index_value(succ))
164164
}
165165

166+
#[inline(always)]
166167
fn count(self) -> usize {
167168
self.iter.count()
168169
}

webgraph/src/labels/proj.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ where
8484
self.0.next().map(|x| x.into_pair().0)
8585
}
8686

87+
#[inline(always)]
8788
fn count(self) -> usize {
8889
self.0.count()
8990
}
@@ -312,6 +313,7 @@ where
312313
self.0.next().map(|x| x.into_pair().1)
313314
}
314315

316+
#[inline(always)]
315317
fn count(self) -> usize {
316318
self.0.count()
317319
}

webgraph/src/traits/labels.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ pub trait SequentialLabeling {
104104
/// Builds the degree cumulative function for this labeling.
105105
///
106106
/// The degree cumulative function is the sequence 0, d₀, d₀ + d₁, … ,
107-
/// *m*, where *dₖ* is the number of labels of node *k* and *m* is the
108-
/// number of labels.
107+
/// *m*, where *dₖ* is the number of arcs/labels of node *k* and *m* is the
108+
/// number of arcs/labels.
109109
///
110110
/// # Panics
111111
///
@@ -494,6 +494,7 @@ impl<I: Iterator> Iterator for AssumeSortedIterator<I> {
494494
self.iter.next()
495495
}
496496

497+
#[inline(always)]
497498
fn count(self) -> usize {
498499
self.iter.count()
499500
}

webgraph/tests/test_build_dcf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
55
*/
66

7-
//! Tests for [`SequentialGraph::build_dcf`] and its overrides in
7+
//! Tests for [`SequentialLabeling::build_dcf`] and its overrides in
88
//! [`BvGraphSeq`], [`CsrGraph`], and [`CsrSortedGraph`].
99
1010
mod common;

0 commit comments

Comments
 (0)