Re: [gnome-db] libgda performance issues



On 6/21/07, Vivien Malerba <vmalerba gmail com> wrote:
>
> Code is *very simple*.
>
> command = gda_command_new (query,
>                         GDA_COMMAND_TYPE_SQL,
>                         GDA_COMMAND_OPTION_STOP_ON_ERRORS);
> GdaDataModel *model =
>                 gda_connection_execute_select_command(
>                                 connection,
>                                 command, NULL, NULL);
> gda_command_free(command);
>
> ret_rows = gda_data_model_get_n_rows(model);
>
> for (rows = 0; rows < ret_rows; rows++) {
>
>         gvalue = gda_data_model_get_value_at(model, columns, rows);
>
>                         if(G_IS_VALUE(gvalue)) {
>                                         g_object_set_property(G_OBJECT(object),
>                                                         gda_data_model_get_column_title(model, columns),
>                                                         gvalue);
>                         }
> }
>
> This code ( used with MySQL API is **much** faster ):
>
> for (j = 0; j < ret_fields; j++){
>
>         field = mysql_fetch_field_direct(results, j);
>
>         if ((prop = g_object_class_find_property(
>                                                         (GObjectClass *)klass, field->name)) != NULL) {
>
>                 g_value_init(&pval,prop->value_type);
>
>                 switch(prop->value_type){
>
>                                         case G_TYPE_STRING:
>                                                 g_value_set_string(&pval, (gchar *)row[j]);
>                                                 break;
>
>                 /*  more type cases */
>                 }
>         }
>         g_object_set_property(G_OBJECT(object), field->name, &pval);
>         g_value_unset(&pval);
> }
>

I wrote 2 test programs based on the usage of that code, the
difference I got was that libgda incurred a 100% slowdown (time to run
was x2).

then I added G_GNUC_CONST to all the _get_type(void) functions to help
gcc optimize the code (this lead to a 4% performances increase), and
then I disabled the threading and got a real performances improvement,
in the end the slowdown is now around 25% which is much better (of
course it could be better...)

Here is attached a gnumeric file to summarize it all (for what the
tests and measures are worth...).

The code will be in SVN tonight, and to disable threading you have to
set the LIBGDA_NO_THREADS environment variable.

Cheers,

Vivien


With the attachment...

Attachment: tests_100.gnumeric
Description: Binary data



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