Skip to content

Commit 06826c6

Browse files
committed
Try inlining fetch
1 parent 282382a commit 06826c6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/function/fetch.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ impl<C> IngredientImpl<C>
1313
where
1414
C: Configuration,
1515
{
16+
#[inline]
1617
pub fn fetch<'db>(
1718
&'db self,
1819
db: &'db C::DbView,
@@ -57,11 +58,19 @@ where
5758
id: Id,
5859
) -> &'db Memo<'db, C> {
5960
let memo_ingredient_index = self.memo_ingredient_index(zalsa, id);
61+
let mut retry_count = 0u32;
6062
loop {
6163
if let Some(memo) = self
6264
.fetch_hot(zalsa, id, memo_ingredient_index)
6365
.or_else(|| {
64-
self.fetch_cold_with_retry(zalsa, zalsa_local, db, id, memo_ingredient_index)
66+
self.fetch_cold_with_retry(
67+
zalsa,
68+
zalsa_local,
69+
db,
70+
id,
71+
memo_ingredient_index,
72+
&mut retry_count,
73+
)
6574
})
6675
{
6776
return memo;
@@ -103,6 +112,7 @@ where
103112
db: &'db C::DbView,
104113
id: Id,
105114
memo_ingredient_index: MemoIngredientIndex,
115+
retry_count: &mut u32,
106116
) -> Option<&'db Memo<'db, C>> {
107117
let memo = self.fetch_cold(zalsa, zalsa_local, db, id, memo_ingredient_index)?;
108118

@@ -114,7 +124,7 @@ where
114124
// That is only correct for fixpoint cycles, though: `FallbackImmediate` cycles
115125
// never have provisional entries.
116126
if C::CYCLE_STRATEGY == CycleRecoveryStrategy::FallbackImmediate
117-
|| !memo.provisional_retry(zalsa, zalsa_local, self.database_key_index(id))
127+
|| !memo.provisional_retry(zalsa, zalsa_local, self.database_key_index(id), retry_count)
118128
{
119129
Some(memo)
120130
} else {

0 commit comments

Comments
 (0)