Re: [RFC PATCH 0/5] various optimizations

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

 



Christophe Fergeau <cfergeau@xxxxxxxxxx> writes:

> On Tue, Jun 03, 2014 at 06:52:47PM +0200, Giuseppe Scrivano wrote:
>> Christophe Fergeau <cfergeau@xxxxxxxxxx> writes:
>> > The call to osinfo_loader_get_device() can also hide a g_object_new(),
>> > which can be heavy.
>> 
>> indeed, g_object_new seems to be very slow.  I will try to play with
>> what Daniel suggested and see if it makes any difference.
>
> Some profiling should tell you if the expensive part is the object
> creation or the hash table insertion, and how much slower one is
> compared to the ohter. Did you get these numbers by any chance?

for my tests I've used a simple C program statically linked to
libosinfo (compiled with -O0):

#include <osinfo/osinfo.h>

int main()
{
  GError *error;
  OsinfoLoader *loader = osinfo_loader_new();
  osinfo_loader_process_default_path(loader, &error);

  OsinfoDb *db = osinfo_loader_get_db(loader);
  osinfo_db_get_os_list(db);
  return 0;
}

This series was applied to the libosinfo source.

function                   total time spent in the function

osinfo_loader_get_device  32.83%
osinfo_db_get_device      2.96%
osinfo_db_add_device      4.50%
osinfo_db_new             24.97%

so creating a new GObject is very slow.  I thought about creating just a
model object and then clone it instead of going trough the gobject
constructors for every instance.  Does it sound like a good idea?  (I am
not still sure if g_type_create_instance will be enough to achieve this,
haven't looked into details).

Regards,
Giuseppe

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux