![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, When a Row object is constructed, it will copy all data of the fetched row of type MYSQL_ROW to a vector of std::string. That seems to me as unnecessary use of time and memory. The row data is only accessed through pointers to const char: |
urge().|
I have a program where this patch gives more than 20 % decrease of the execution time (from 99 down to 77 seconds) when it runs on an otherwise idle Linux box. |
#3
| |||
| |||
|
|
I have a program where this patch gives more than 20 % decrease of the execution time (from 99 down to 77 seconds) when it runs on an otherwise idle Linux box. This is pretty cool, but perhaps it would be better served with a new row object that is optimized for this. This is up to Warren, but 20% is a nice chunk of CPU time. |
#4
| |||
| |||
|
|
On Sun, May 29, 2005 at 07:28:16PM +0200, Byrial Jensen wrote: Hi, When a Row object is constructed, it will copy all data of the fetched row of type MYSQL_ROW to a vector of std::string. That seems to me as unnecessary use of time and memory. The row data is only accessed through pointers to const char: Something to remember is that Row objects are stored in containers when using SSQLS, as far as I can tell, so this would create a hidden dependency on the Result object: all Row object data would disappear if their lifetimes exceeded the lifetime of the corresponding Result. i.e. The Result destructor calls mysql_free_result() via Result: urge(). |
arent(), Row::size(),
perator bool(), Row:
perator[]() and Row::lookup_by_name() are
#5
| |||
| |||
|
You have a good point. However the functions Row: arent(), Row::size(),Row: perator bool(), Row: perator[]() and Row::lookup_by_name() arealready now dependent on the parent Result object - it gives undefined behavour to use these functions after the destruction of the Result. The only useful member function left which now can be used without the parent is Row::raw_data(). |
|
If the lifetime of a Row object really is expected to be able to extend the lifetime of the parent Result object, I would suggest a rewrite to remove the current dependencies. |
#6
| |||
| |||
|
|
Actually, after some thought, an iterator into a Result would be the most logical way to access this, |
#7
| |||
| |||
|
|
I went looking into the current result iterator stuff |
![]() |
| Thread Tools | |
| Display Modes | |
| |