[gnome-db] gda_holder_set_value_static_str
- From: Massimo Cora' <maxcvs email it>
- To: gnome-db list <gnome-db-list gnome org>, Vivien Malerba <vmalerba gmail com>
- Subject: [gnome-db] gda_holder_set_value_static_str
- Date: Mon, 25 Aug 2008 22:32:45 +0200
Hi Vivien,
while trying to optimize the speed of some queries I came on
g_value_set_static_string (), which is good and faster than its brother
g_value_set_str ().
I was wondering if it was possibile to add a
gda_holder_set_value_static_str ()?
Another question, always in that fashion:
gda_holder_take_value () takes as input a *value that is freed when the
holder is re-set. That method returns TRUE if value has been set.
I was thinking about this speed improvement:
create a gda_holder_take_value_do_not_free () [well, the name is
unlucky...] that when is re-set will return the stored value instead of
freeing it. In this manner it's possible to reuse that GValue without a
g_free () and g_value_new_*().
Think for instance to a prepared query that needs a gchararray parameter
in a function foo_func ():
* create and set a GValue of type G_TYPE_STRING on a
global_managed_gvalue1 in a static way. [i.e. no string
allocations/duplications required]
* get the list of holders with gda_statement_get_parameters ().
* set the global_managed_gvalue1 to the holder with
gda_holder_take_value_do_not_free ().
* the above method will return NULL because no previous values were taken.
* ... do some stuff then return on the foo_func () to re-exec the query
* re-set the holder's value with a global_managed_gvalue2 and take the
returned old value global_managed_gvalue1, which is now set as
'reusable' for a memory objects pool.
total number of allocations: holders for the query and two globals
values, better if allocated at program start. No string extra dups are
required at all.
Currently the above method will require something like: holders for the
query, two allocations for the GValues and two dups, and the respective
gda_value_free () when a new value replaced within the holder with
gda_holder_take_value ().
The thoughts can be done with gda_holder_set_value_static_str ().
I'm sure I can achieve better performances if those method would be
available, what do you think?
thanks and regards,
Massimo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]