[#70257] [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI — ko1@...

Issue #11420 has been reported by Koichi Sasada.

11 messages 2015/08/06

[ruby-core:70358] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI

From: Eric Wong <normalperson@...>
Date: 2015-08-12 23:07:42 UTC
List: ruby-core #70358
SASADA Koichi <ko1@atdot.net> wrote:
> On 2015/08/13 4:29, Юрий Соколов wrote:
> > I thought to suggest to embed hash_id_table directly into places when it
> > is used (instead of pointer to).
> > It will use 24byte on 64bit platform, so not too big.
> > It has benefit when used with jemalloc/tcmalloc which are good at
> > allocating sizes = 2**x.
> > With flexible array size will be not equal to power of 2, so that they
> > will consume a bit more memory on big tables.
> > 
> > But I think flexible array are also very good idea.
> > Let me know, if I need to fix hash variant for this.
> 
> For flexible array, I'm negative because it can conflict usage like
> updating tables during foreach, and so on. Just now, we need to clear
> usages first. I think impact of flexible array is not so big (compare
> with current implementation), or so big?

Probably makes most difference with few (1..5) maybe? elements.
Since this is for internal use, we should disallow updates during
iteration.  It makes very complicated corner cases in st.c

> For embedding tables, I also negative because we need to expose table
> data structure for users. Just now, I want to hide it into id_table.c.
> Of course, if we decide this implementation finally, we can try it.

I see no problem exposing data structures to internal.h users.
Just keep it out of public C API.
Only downside is increased compile time for C Ruby devs (I use ccache).

In This Thread