Joined: 25 Jun 2016
|Posted: Tue Jun 28, 2016 6:42 pm Post subject: Timing Anomalies Need Explanation
|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;
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:
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.
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?
-- Mike R.