lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello Philippe !

I think I already heard you mentioning this before and asked you to share your implementation, is it possible ?

Cheers !

On 24/11/20 13:11, Philippe Verdy wrote:
That's the caveat of the implementation using very poor assumptions without ever considering the worst cases that are not even rare for very specific apps. I've replaced cpldtely the array+hash approach by a single B-tree using a natural sort order by number value or hash for all strings and refs, and all worst cases have disappeared. Btrees are very fast and no rehashing is ever needed to compact them, and compaction can be tuned by only a fill factor and an optional page size

Le mar. 24 nov. 2020 à 12:43, Mimmo Mane <pocomane_7a@pocomane.com> a écrit :
On Mon, Nov 23, 2020 at 9:27 PM Luiz Henrique de Figueiredo wrote:
> It seems to me that the issue, if any, is creating new entries in a
> table, not assigning nils. I don't expect any penalty when clearing
> existing fields.

To me instead it seems the issue is exaclty about assigning nil.
Infact the performance strongly change changing
  game_field[j] = nil
to
  game_field[j] = false
too.

But does this mean that it is not just a re-hash issue?