Re: [RFC PATCH 2/5] osinfo_loader: avoid multiple calls to OSINFO_ENTITY

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

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> writes:

> On Tue, Jun 03, 2014 at 04:08:09PM +0200, Giuseppe Scrivano wrote:
>> Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx>
>> ---
>>  osinfo/osinfo_loader.c | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>> 
>> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
>> index aa5e48f..a767bb8 100644
>> --- a/osinfo/osinfo_loader.c
>> +++ b/osinfo/osinfo_loader.c
>> @@ -1657,19 +1657,20 @@ osinfo_loader_process_file_reg_ids(OsinfoLoader *loader,
>>                                              baseURI, vendor_id, device_id);
>>  
>>                  OsinfoDevice *dev = osinfo_loader_get_device(loader, id);
>> -                osinfo_entity_set_param(OSINFO_ENTITY(dev),
>> +                OsinfoEntity *entity = OSINFO_ENTITY(dev);
>> +                osinfo_entity_set_param(entity,
>>                                          OSINFO_DEVICE_PROP_VENDOR_ID,
>>                                          vendor_id);
>> -                osinfo_entity_set_param(OSINFO_ENTITY(dev),
>> +                osinfo_entity_set_param(entity,
>>                                          OSINFO_DEVICE_PROP_VENDOR,
>>                                          vendor);
>> -                osinfo_entity_set_param(OSINFO_ENTITY(dev),
>> +                osinfo_entity_set_param(entity,
>>                                          OSINFO_DEVICE_PROP_PRODUCT_ID,
>>                                          device_id);
>> -                osinfo_entity_set_param(OSINFO_ENTITY(dev),
>> +                osinfo_entity_set_param(entity,
>>                                          OSINFO_DEVICE_PROP_PRODUCT,
>>                                          device);
>> -                osinfo_entity_set_param(OSINFO_ENTITY(dev),
>> +                osinfo_entity_set_param(entity,
>>                                          OSINFO_DEVICE_PROP_BUS_TYPE,
>>                                          busType);
>>                  g_free(id);
>
> Does this change actually have a measurable performance benefit ?
>
> If it does have a measurable benefit, then ACK, but otherwise I
> tend to prefer the code as it is really.

not really, it only reduces the number of function calls.  I will drop
this change.

Thanks,
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