Business Object Performance


Author
Message
Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
I have a routine that is importing Foxpro Data. This week  made some changes and added a few larger tables(more records and more fields) to the import routine that has been running for months. These "new" tables are by no means crazy huge as the largest one is right around 75,000 records and 30 or so fields. This routine has been running at night so I never really noticed if this has always been an issue. however while debugging changes noticed that the performance was lacking..  

Once I started looking onto it I was very suprised at the perfomance vs a plain datatable. I did expect a business object to have some additional overhead over a vanilla datatable , however I was expecting a very minimal difference compared to the results I am seeing. Perhaps I am missing something easy like not setting a business object property or I am looking at something completly wrong. Whatever it is there seems to be a huge performance difference that I would like to get to the bottom of it.

To take anything I was doing out of the mix I created a test project that uses the stataframe sample orderitems table as a source and destination bo. I then created a standard plain old vanilla BO mapped to the items table. The only business object property that is changed from default is the "allowsnullvaluesonnewrow" is set to true.

Basically I fill a 'source' business object Then loop through the 'source' business object and create a new row on a destination object and sets the value of a field on the destination object from the source .

Business Object Example

'Set Start Time

starttime = DateTime.Now

'Loop through filled Business Object

For Each bo As itemsbo In SourceBO.GetEnumerable

'Create New Row in Destination Business Object

DestinationBO.NewRow()

'Set Value of 1 field

DestinationBO.orit_Quantity = bo.orit_Quantity

Next

'Set Stop Time

stoptime = DateTime.Now

'Set Elapsed

elapsed_time = stoptime.Subtract(starttime)

Same routine using a vanilla datatable.

'Set Start Time

starttime = DateTime.Now

'Loop through filled Business Object

For Each bo As itemsbo In SourceBO.GetEnumerable

lorow = dt.NewRow

'-- Set Value of 1 fld

lorow("orit_Quantity") = bo.orit_Quantity

'-- Add the new row to the data table

dt.Rows.Add(lorow)

Next

'Set Stop Time

stoptime = DateTime.Now

'Set Elapsed

elapsed_time = stoptime.Subtract(starttime)

Here are my results based on 50,000 records from the strataframe order items table. These times do not include any filling of data or saving of data.

Use a bo to create a new row and set no values                    .54 seconds

use a bo to create a new row and set the value of one field     5.04 seconds

use a bo to create a new row and set the value of two fields   9.51 seconds

use a bo to create a new row and set the value of 3 fields     14.17 seconds

----------------Data Table--------

Use a datatable to create a new row and set no values            .21 seconds

use a dt to create a new row and set the value of one field      .31 seconds

use a dt to create a new row and set the value of two field      .45 seconds

use a dt to create a new row and set the value of 3  fields      .51 seconds

 

Reply
Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Thanks Trent.

For the most part the import routine that this affect's runs after hours unless there is some type of exception that would require a manual rerun. So rather than refactor the mapping methods to use a datatable I will leave it as is for now as I do have some other stuff going on that I might break. So it is not a life or death issue for me but I did want to find out what was going on, and obviously resolve it.

I understand 100% that this will not be a "quick" fix as the underlying datatable events have to be one of the worms at the bottom of the business object can.

Appreciate ya,

Paul  

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Paul Chase - 15 Years Ago
Paul Chase - 15 Years Ago
Paul Chase - 15 Years Ago
                 I am taking a look at it right now.
Trent L. Taylor - 15 Years Ago
                     Paul,

I will have to look at this some more tomorrow. I am...
Trent L. Taylor - 15 Years Ago
                         Thanks Trent.
Paul Chase - 15 Years Ago
                             Paul,

The code issue is actually happening within the...
Trent L. Taylor - 15 Years Ago
                                 One more thought...the main thing here is that before we make any...
Trent L. Taylor - 15 Years Ago
                                     Thanks Trent. For the most part the import routine that this...
Paul Chase - 15 Years Ago
                                     Trent, I recently updated to the latest version of SF and was unable...
Paul Chase - 14 Years Ago
                                         Well, I am not sure that it is actually an issue. From reading...
Trent L. Taylor - 14 Years Ago
                                             Hey Trent, I respectfully disagree that this is not really an issue...
Paul Chase - 14 Years Ago
Les Pinter - 15 Years Ago
Paul Chase - 15 Years Ago
Les Pinter - 15 Years Ago
Keith Chisarik - 15 Years Ago
Edhy Rijo - 15 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search