From: Pavel Fedin <p.fedin@samsung.com>
To: 'Peter Crosthwaite' <peter.crosthwaite@xilinx.com>
Cc: qemu-devel@nongnu.org, 'Luiz Capitulino' <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] Ping: [PATCH] qobject: object_property_add() performance improvement
Date: Thu, 04 Jun 2015 13:01:26 +0300 [thread overview]
Message-ID: <018701d09ead$6c5624a0$45026de0$@samsung.com> (raw)
In-Reply-To: <CAEgOgz7dsaYbSy8c1mkhx_maZnY-vjUbyN8ENHM2X07xn8LMNA@mail.gmail.com>
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
next prev parent reply other threads:[~2015-06-04 10:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 7:35 [Qemu-devel] Ping: [PATCH] qobject: object_property_add() performance improvement Pavel Fedin
2015-06-04 8:07 ` Peter Crosthwaite
2015-06-04 10:01 ` Pavel Fedin [this message]
2015-06-04 13:06 ` Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='018701d09ead$6c5624a0$45026de0$@samsung.com' \
--to=p.fedin@samsung.com \
--cc=lcapitulino@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.