qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Ping: [PATCH] qobject: object_property_add() performanc


From: Pavel Fedin
Subject: Re: [Qemu-devel] Ping: [PATCH] qobject: object_property_add() performance improvement
Date: Thu, 04 Jun 2015 13:01:26 +0300

 Hello!

> >> +         void *v = g_malloc0(sizeof(uint32_t));
> >> +
> 
> Can you allocate name_no_array here along with the count in a small
> struct to save on some allocs and memcpys?

 How can i? Here i allocate persistent storage space for the property, which is 
kept along. And name_no_array is a temporary buffer which is freed after usage 
because property names are copied when respective properties are added.

> >> +            count = object_property_add_single(obj, name, "uint32",
> >> +                                               property_get_uint32_ptr, 
> >> NULL,
> 
> Do you need to register the getter or can you make it completely
> opaque instead? 

 I don't need getter, but i decided to register it just in case, because i 
suggest that it could be useful for example for manual object inspection using 
monitor. Does monitor have this capability?

> Alternatively can you register the setter and use
> set/get instead of going hands on with the property opaque pointer?

 I wanted to do this but i remember having something like 
object_property_get_int() function but missing object_property_set_int() 
counterpart (sorry i may have forgotten the exact names) because apparently 
settable properties start only from qdev class. I decided not to write too much 
code for a single use case. It's even slightly faster to use a pointer. And by 
design this property is supposed to be read-only, because anyway setting it 
from outside isn't a good idea.

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia





reply via email to

[Prev in Thread] Current Thread [Next in Thread]