[#61424] [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals — Eric Wong <normalperson@...>

I'm unsure about this. I _hate_ the extra branches this adds;

13 messages 2014/03/12

[ruby-core:61606] Re: hash function for global method cache

From: Eric Wong <normalperson@...>
Date: 2014-03-20 07:12:19 UTC
List: ruby-core #61606
SASADA Koichi <[email protected]> wrote:
> (2014/03/18 8:03), Eric Wong wrote:
> > Global method cache is power-of-two-sized; so it should have a good hash
> > function.  In vm_method.c:
> 
> FYI (maybe you know): funny_fulcon proposed to replace global cache by
> per-class cache.
> https://bugs.ruby-lang.org/issues/9262

Yes, that issue is for growing global cache, though.  It seems per-class
cache idea is dead for now.

Long term hope is to get rid of the global cache and only use inline
cache.

ihash[1] with hash-based IDs[2] should be faster than the current st.c +
incrementing IDs.  However my primary goal of ihash was memory saving,
but speed should happen because of reduced indirection.

I will also try RB tree (steal rb.h from jemalloc) or splay tree
(*BSD sys/tree.h) for method tables/constants.  id/symbol table
might be too big for a binary search tree.


[1] - https://bugs.ruby-lang.org/issues/9614
      git://80x24.org/ruby.git ihash5

[2] - not implemented, yet, probably not going to touch parse.y
      until Symbol GC patch is merged.

In This Thread