Subject | Re: [IBO] development |
---|---|
Author | Jason Wharton |
Post date | 2010-03-21T14:41:51Z |
Hans,
You need to call the BeginBusy() and EndBusy methods when you are doing
these kinds of things.
Your performance will increase dramatically. This has been a documented and
heavily discussed aspect for a long time.
In short, you avoid all of the overhead of what it takes for IBO to go to
the trouble of informing the system that the database is now actively
engaged in processing. This involves changing the status of the screen
cursor, among other things.
Also, using the Assign() method involves additional overhead. The precise
behavior for this method requires that the original contents of the two
colums involved be compared and other dataset level flags be adjusted so
that the Modified property is only registering a change if there is an
actual change in content. Obviously, this is not of concern since you are
just processing data in a straight forward manner and not looking for these
finer distinctions to work correctly.
In short, there is much that SHOULD be done in order to have a technically
precise means of interacting with your data that FIBPlus does NOT do. Of
course this results in greater performance, but all of that performance is
YET available in IBO if you learn to use it correctly while you maintain the
far superior technical accuracy in the interactions with your data.
Also, the most appropriate way to do this in IBO is to use the TIB_DataPump.
I suggest you give that component a go and then come back with your
benchmark results. You will find that IBO's performance will be better than
FIBPlus to do this task. There's no way it can outperform IBO in this
because the TIB_DataPump distills everything down to virtually raw API calls
with minimal overhead and it even uses the same buffer space. Your pumping
of data boils down to this:
Prepare all necessary cursor/dsql statements.
Organize all of the column mappings.
Look for column assignments that are compatible for sharing buffer space.
(DIRECT)
Open the source cursor.
Begin loop:
CALL API TO FETCH SOURCE
If non DIRECT buffering then
Assign values between those columns.
CALL API TO EXECUTE DEST
End loop:
So, if all of your columns are directly buffer compatible you have a loop of
two API calls going on. You cannot TOP that!
IBO is not for people who want to just slap together basic routines and
expect top notch performance. IBO is for those who are willing to come to
know it as if their livlihood depended on it and to always be willing to
ask: Am I making the most of this toolset?
If I was just doing some quick and dirty things that required no long-term
maintenance and were just one-off tasks then a cheap tool like FIB+ is
likely the way to do. But, if you have a serious project and you are in a
committed relationship to it where all performance you can get with the
least amount of effort (aside from some learning curve) is what you want,
then you are definitely the right customer for IBO. It is written with that
kind of development environment in mind.
Regards,
Jason Wharton
> Hi, I wish to share my concern.Yes, it most definitely is.
>
> I just wanted to copy all tables and contents from one 128M test database
> to
> another database and used some IB_Cursors to loop throught the table names
> and the fields
> update loop like:
>
> with IB_Cursor_Old do
> begin
> IB_Cursor_New.Append;
> for i := 0 to FieldCount - 1 do
> IB_Cursor_New.Fields[i].Assign(IB_Cursor_Old.Fields[i]);
> IB_Cursor_New.Post;
>
> Then I downloaded a test copy of FIBPlus 6.5, which seems to be designed
> for
> many
> platforms and all Delphi versions from 5 and up, and merely replaced the
> IB_Cursors with
> their tpFIBDataset, for the rest using the almost identical coding as I
> used
> for IBObjects.
>
> Using Firebird 2.1.3 on the same computer as the copying tests, creating
> identical results,
> using basic objects in a very basic way
>
> The total run time using IBOjects 4.8.4 was 32 Mins and 35 Secs (1955
> Secs)
> The total run time using FIBPlus 6.5 was 1 Min and 32 Secs
> ( 92
> Secs)
>
> FIBPlus about 21+ times faster than IBObjects.
>
> My concern, as a long time supporter of IBObjects since the early versions
> V3.xx,
> is the IBObject development going in the right direction ?
You need to call the BeginBusy() and EndBusy methods when you are doing
these kinds of things.
Your performance will increase dramatically. This has been a documented and
heavily discussed aspect for a long time.
In short, you avoid all of the overhead of what it takes for IBO to go to
the trouble of informing the system that the database is now actively
engaged in processing. This involves changing the status of the screen
cursor, among other things.
Also, using the Assign() method involves additional overhead. The precise
behavior for this method requires that the original contents of the two
colums involved be compared and other dataset level flags be adjusted so
that the Modified property is only registering a change if there is an
actual change in content. Obviously, this is not of concern since you are
just processing data in a straight forward manner and not looking for these
finer distinctions to work correctly.
In short, there is much that SHOULD be done in order to have a technically
precise means of interacting with your data that FIBPlus does NOT do. Of
course this results in greater performance, but all of that performance is
YET available in IBO if you learn to use it correctly while you maintain the
far superior technical accuracy in the interactions with your data.
Also, the most appropriate way to do this in IBO is to use the TIB_DataPump.
I suggest you give that component a go and then come back with your
benchmark results. You will find that IBO's performance will be better than
FIBPlus to do this task. There's no way it can outperform IBO in this
because the TIB_DataPump distills everything down to virtually raw API calls
with minimal overhead and it even uses the same buffer space. Your pumping
of data boils down to this:
Prepare all necessary cursor/dsql statements.
Organize all of the column mappings.
Look for column assignments that are compatible for sharing buffer space.
(DIRECT)
Open the source cursor.
Begin loop:
CALL API TO FETCH SOURCE
If non DIRECT buffering then
Assign values between those columns.
CALL API TO EXECUTE DEST
End loop:
So, if all of your columns are directly buffer compatible you have a loop of
two API calls going on. You cannot TOP that!
IBO is not for people who want to just slap together basic routines and
expect top notch performance. IBO is for those who are willing to come to
know it as if their livlihood depended on it and to always be willing to
ask: Am I making the most of this toolset?
If I was just doing some quick and dirty things that required no long-term
maintenance and were just one-off tasks then a cheap tool like FIB+ is
likely the way to do. But, if you have a serious project and you are in a
committed relationship to it where all performance you can get with the
least amount of effort (aside from some learning curve) is what you want,
then you are definitely the right customer for IBO. It is written with that
kind of development environment in mind.
Regards,
Jason Wharton