c# - Access DAO Performance issue -


i'm using microsoft.office.interop.access.dao.dbengine write data existing accdb template. done class in assembly.

now i'm observing 2 cases: when start routine (debug build) within xunit (1.9.2 vs runner 2.0.1) test 32bit process within te.processhost.managed.exe needs minute complete. starting release build console application in 32 bit mode needs more 12 minutes. i'm instantiating new dbengine() , later call opentable(name) per table fill , table.update() per row insert (no updates, inserts only). assembly references microsoft.office.interop.access.dao.dll version 15.0.4420.1017 (access 2010).

i'm looking clue start digging reason these massive discrepancy.

edit: basically, it's copy job sql-server access db, first reads data via ado sql-server , inserts accdb. (not exact code):

foreach(var tablename in tables) {   readsqlintoarray(tablename, tabledata);   var daotable = daodb.opentable(tablename);   foreach(var row in tabledata)   {     // ... add new record , copy data      daotable.update();  // expensive call in console app   } } 

the unit test creates parameters copy job, creates relevant object , starts job. console app right same. profiling, timing , debugging lead table.update() being call cost. sql read shows no differences , ist therefor ruled out cause of problem.

the reason asking here actually, need idea, can further investigate, since code shows no obvious differences.

there no reflection, generics, unsafe code or hidden artifacts in calling methods (runner vs console app), explain such behavior, since both of them build runtime parameters , call job. compared these parameters char. wondered, if there 'environmental difference' between console app , vs test runner, since i'm dealing com object here.

update 2:

i had time investigate issue again, these days. added timing measurements compare individual steps. fetching data sql server done in similiar time. interesting part again here:

foreach(var tablename in tables) {   readsqlintoarray(tablename, tabledata);   var daotable = daodb.opentable(tablename);    foreach(var row in tabledata)   {     var rowarray = row.itemarray;      // because of type conversions loop necessary     (int = 0; < rowarray.length; i++)     {         var srcvalue = rowarray[i];         if (srcvalue.gettype() == typeof(timespan))         {             // timespan cannot automatically converted , cause exception             tabl.fields[i].value = ((timespan)srcvalue).tostring(@"hh\:mm");         }         else if (srcvalue.gettype() == typeof(guid))         {             // guid cannot automatically converted , cause exception             // wrap string             tabl.fields[i].value = ((guid)srcvalue).tostring();          }          else          {              // assignment taking longer in console app              // in testrunner (te.processhost.managed.exe)              tabl.fields[i].value = srcvalue;          }     }      daotable.update();     } } 

it seems, assignments of fields of table row seem behave differently, although it's same code lines. in debugger cannot see, if underlying com objects of same type in test , console. such experiences in com objects within managed apps?

one approach may utilize passthru queries in msaccess file retrieve data sqlserver, , using insert query copy data local access table(s). since there no user code curious see if there performance difference. if not, external problem, disk io, indexing, or network problems (assuming sql server on different computer).


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -