mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 14:21:10 +02:00
Add weak-table fast path for update
* libguile/weak-table.c (weak_table_put_x): If the key is the same and the table is weak-key, avoid re-setting disappearing links.
This commit is contained in:
parent
5a3bc32c99
commit
668153dbb6
1 changed files with 10 additions and 0 deletions
|
@ -686,6 +686,16 @@ weak_table_put_x (scm_t_weak_table *table, unsigned long hash,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fast path for updated values for existing entries of weak-key
|
||||||
|
tables. */
|
||||||
|
if (table->kind == SCM_WEAK_TABLE_KIND_KEY &&
|
||||||
|
entries[k].hash == hash &&
|
||||||
|
entries[k].key == SCM_UNPACK (key))
|
||||||
|
{
|
||||||
|
entries[k].value = SCM_UNPACK (value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (entries[k].hash)
|
if (entries[k].hash)
|
||||||
unregister_disappearing_links (&entries[k], table->kind);
|
unregister_disappearing_links (&entries[k], table->kind);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue