[runtime] Change MonoDomain::refobject_hash to use MonoConcGHashTable.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 29 May 2017 03:16:29 +0000 (20:16 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 29 May 2017 03:16:29 +0000 (20:16 -0700)
commit4e72eaacaacbd005446614fe415f24245d14c82b
tree7591220ec63fe33d5574c802bc8bee89a527eebd
parent3a0d3e1169c9f3b927249fb07fcd70e0b0d0c421
[runtime] Change MonoDomain::refobject_hash to use MonoConcGHashTable.

This change massively improves reflection query scalability.

Given this benchmark and my 4 cores laptop:

```
const int T_C = 4;
var list = new List<Thread> ();
bool done = false;
int count = 0;
for (int i = 0; i < T_C; ++i) {
var t = new Thread(() => {
while (!done) {
typeof (Driver)
.GetMethods (
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.Static);
Interlocked.Increment (ref count);
}
});
t.Start ();
list.Add (t);
}

Thread.Sleep (5000);
done = true;
foreach (var t in list)
t.Join ();
Console.WriteLine ("Got {0} lists done", count);
```

This change makes us go from 166.725 queries/s to 5.140.821 queries/s. Or 30x faster.
mono/metadata/domain-internals.h
mono/metadata/mono-conc-hash.c
mono/metadata/reflection-cache.h
mono/metadata/reflection.c