Skip to content

Commit dea24e9

Browse files
perf: make pcache a map of struct{}
1 parent 3c0cffc commit dea24e9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/freelist/shared.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,18 @@ func (t *shared) Reload(p *common.Page) {
220220

221221
func (t *shared) NoSyncReload(pgIds common.Pgids) {
222222
// Build a cache of only pending pages.
223-
pcache := make(map[common.Pgid]bool)
223+
pcache := make(map[common.Pgid]struct{})
224224
for _, txp := range t.pending {
225225
for _, pendingID := range txp.ids {
226-
pcache[pendingID] = true
226+
pcache[pendingID] = struct{}{}
227227
}
228228
}
229229

230230
// Check each page in the freelist and build a new available freelist
231231
// with any pages not in the pending lists.
232232
a := []common.Pgid{}
233233
for _, id := range pgIds {
234-
if !pcache[id] {
234+
if _, ok := pcache[id]; !ok {
235235
a = append(a, id)
236236
}
237237
}

0 commit comments

Comments
 (0)