Couldn't it check whether there has been resize in between and avoid the second lookup if there hasn't been one?
-- vyzo
I’m currently reimplementing tables, so it is a good time to consider this.
However, the “obvious” implementation which does one lookup will not work because the update procedure may cause the gc hash table to be resized. So a lookup must be done before and after the update procedure is executed. However it is possible to avoid repeating some type checks.
Marc
> On Oct 26, 2019, at 12:45 PM, Dimitris Vyzovitis <vyzo@hackzen.org> wrote:
>
> Marc,
>
> Can we add a table-update! primitive?
> Updates are currently slow because they need two lookups in the hash table, one to find the current value (if any) and one to set it.
> The canonical signature is (table-update! table key update default), where update is applied to the current value, using default if the value is unset.
>
> -- vyzo