]> git.proxmox.com Git - qemu.git/commit
qom: aggressively optimize qom casting
authorAnthony Liguori <aliguori@us.ibm.com>
Mon, 13 May 2013 20:22:24 +0000 (15:22 -0500)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 13 May 2013 20:27:18 +0000 (15:27 -0500)
commit035873283b3f7514ad77d409870ccfd5f9680d9e
treec7b21f32c53e37dc7da2030debe1ecbaae98384a
parentb087143b4d010451208264b7c841436aafe1cbb1
qom: aggressively optimize qom casting

This patch adds a small typename cache to ObjectClass.  This allows
caching positive casts within each ObjectClass.  Benchmarking a
PPC workload provided by Aurelien, this patch eliminates every
single g_hash_table_lookup() happening during the benchmark (which
was about 2 million per-second).

With this patch applied, I get exactly the same performance (within
the margin of error) as with --disable-qom-cast-debug.

N.B. it's safe to cache typenames only from the _assert() macros
because they are always called with string literals.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
include/qom/object.h
qom/object.c