Skip to content

Commit

Permalink
Update robin_map and use its new .erase_fast() method
Browse files Browse the repository at this point in the history
See Tessil/robin-map#76 and
#507 for context.

(This is still a pre-release version of robin-map, I will update
 the referenced commit once a proper release has been made)
  • Loading branch information
wjakob committed Apr 19, 2024
1 parent eddcf08 commit 9f4e46b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/nb_type.cpp
Expand Up @@ -245,7 +245,7 @@ static void inst_dealloc(PyObject *self) {
"keep_alive information", t->name);

nb_weakref_seq *s = (nb_weakref_seq *) it->second;
keep_alive.erase(self, self_hash);
keep_alive.erase_fast(it);

do {
nb_weakref_seq *c = s;
Expand All @@ -271,7 +271,7 @@ static void inst_dealloc(PyObject *self) {
void *entry = it->second;
if (NB_LIKELY(entry == inst)) {
found = true;
inst_c2p.erase(p, p_hash);
inst_c2p.erase_fast(it);
} else if (nb_is_seq(entry)) {
// Multiple objects are associated with this address. Find the right one!
nb_inst_seq *seq = nb_get_seq(entry),
Expand All @@ -287,7 +287,7 @@ static void inst_dealloc(PyObject *self) {
if (seq->next)
it.value() = nb_mark_seq(seq->next);
else
inst_c2p.erase(p, p_hash);
inst_c2p.erase_fast(it);
}

PyMem_Free(seq);
Expand Down

0 comments on commit 9f4e46b

Please sign in to comment.