Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Timing Anomalies Need Explanation

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support
View previous topic :: View next topic  
Author Message
MikeR



Joined: 25 Jun 2016
Posts: 29

PostPosted: Tue Jun 28, 2016 6:42 pm    Post subject: Timing Anomalies Need Explanation Reply with quote

I've been doing some timing tests with VDO during an eval prior to purchase. I'm connecting with PostgreSQL via ODBC which hooks to VDO nicely.

When I execute this code, C#, Windows Forms, VS2015, .NET 4.5:

virtConn = new VirtualConnection("DSN=PostgreSQL30; Database=LogMgr;", "postgres", "", -1, 5);
virtConn.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
virtRSet = new VirtualRecordset();
virtRSet.VirtualConnection = virtConn;
virtRSet.TableName = "SearchTbl";
virtRSet.PrimaryKey = "SID";
virtRSet.SelectClause = "select * from SearchTbl";
...
for (int i=0; i<1000; i++)
{
VirtualRecord vr = virtRSet.AddNew();
vr["sid"] = i + 1;
vr["name"] = "Mike" + (i + 1).ToString();
vr["sts"] = DateTime.Now;
vr["lts"] = DateTime.Now;
vr.Update(true);
}
...
This code adds 1000 records to my database (I can see them in the admin tool, they add correctly) and it takes 36 seconds to do this.

If I then add both VDO components onto the same form, and configure them identically with the coded ones (except using unique names provided by the designer, and the default cache size of 20), same table name, select clause, same connection string, etc., start with empty database, now there are 2 connections to the same db, and repeat the run, it only takes 8 seconds to add the same 1000 rows. Not complaining about THAT, but I'd like an explanation for it if you have one.

In order to see the records just added in a data grid component on the form hooked to the VDO recordset I placed on the form, I have added this code at the end of the above code AFTER the loop completes:

virtualConnection1.RefreshRecordsets(true);

If you don't do this, you never see the results in the grid. Not complaining about that, obviously that's a speed optimization.

So everything appears to work correctly, I'd just like to know the explanation for the disparity in the timings above, as the difference is significant.

UPDATE:

If I remove the coded connection and virtual recordset, and just use the VDO components on the form, the time required to add and delete the records is insignificant, 0 seconds, and the grid loads instantly.

So there must be some caching going on. Not sure who is doing it, though. Can anyone explain this?

Thanks.
_________________
Thanks,

-- Mike R.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jun 29, 2016 11:34 pm    Post subject: Reply with quote

Try changing vr.Update(true) to vr.Update(false). Forcing the virtual recordset to refresh at every loop iteration is probably the cause. You can call virtRSet.Refresh at the end after the loop.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group