X++:
static void Job3798_3(Args _args)
{
VirtualDataAreaList virtualDataAreaList;
Dataarea Dataarea;
int tick1;
int tick2;
int i;
DictTable dictTable;
common common;
common common2;
container contable =
// [tableNum(LEDGERJOURNALPOSTCONTROLUSERGROUP), "100"] // time 0,19 steps 20000 table LedgerJournalPostControlUserGroup (company = 100)
// [tableNum(LEDGERJOURNALPOSTCONTROLUSERGROUP), "dat"] // time 0,17 steps 20000 table LedgerJournalPostControlUserGroup (company = dat)
// [tableNum(LEDGERBALANCESHEETDIMFILEFORMAT), "100"] // time 0,17 steps 20000 table LedgerBalanceSheetDimFileFormat (company = 100)
// [tableNum(LEDGERBALANCESHEETDIMFILEFORMAT), "dat"] // time 0,19 steps 20000 table LedgerBalanceSheetDimFileFormat (company = dat)
// [tableNum(SalesTable), "100"] // time 0,25 steps 20000 table SalesTable (company = 100)
// [tableNum(SalesTable), "dat"] // time 0,25 steps 20000 table SalesTable (company = dat)
// [tableNum(DIRPARTYADDRESSRELATIONSHIPMAPPING), "100"] // time 10,25 steps 20000 table DirPartyAddressRelationshipMapping (company = gab) win2003 - CPU 2,6 GHz
// time 18,55 steps 20000 table DirPartyAddressRelationshipMapping (company = gab) win2008 R2 - CPU 2,3 GHz
// [tableNum(DIRPARTYADDRESSRELATIONSHIPMAPPING), "dat"] // time 10,19 steps 20000 table DirPartyAddressRelationshipMapping (company = gab)
// time 19,73 steps 20000 table DirPartyAddressRelationshipMapping (company = gab) win2008 R2
// [tableNum(CustTable), "100"] // time 10,08 steps 20000 table CustTable (company = hld) - win2003
// time 0,22 steps 20000 table CustTable (company = dat) - win2008 R2
// [tableNum(CustTable), "dat"] // time 0,22 steps 20000 table CustTable (company = dat)
// [tableNum(SysUserLog), "100"] // time 0,20 steps 20000 table SysUserLog (company = No savePerCompany) - win2008 R2
// [tableNum(SysUserLog), "dat"] // time 0,19 steps 20000 table SysUserLog (company = No savePerCompany) - win2008 R2
[tableNum(GRD_SpecialDeptsInventLocations), "100"] // time 14,02 steps 20000 table GRD_SpecialDeptsInventLocations (company = msc) for win2003
// time 27,16 steps 20000 table GRD_SpecialDeptsInventLocations (company = msc) for win2008 R2
// [tableNum(GRD_SpecialDeptsInventLocations), "dat"] // time 0,16 steps 20000 table GRD_SpecialDeptsInventLocations (company = dat) for win2003
// time 0,19 steps 20000 table GRD_SpecialDeptsInventLocations (company = dat) for win2008 R2
;
;
appl.setDefaultCompany(conPeek(contable, 2));
dictTable = new SysDictTable(conPeek(contable, 1));
common = dictTable.makeRecord();
common.(fieldNum(common, recid)) = 123; // force kernel to create a buffer instance
select count(recId) from Dataarea where Dataarea.isVirtual;
info(strFMT("count VirtCompanies = %1", Dataarea.RecId));
select count(recId) from Dataarea where !Dataarea.isVirtual;
info(strFMT("count Companies = %1", Dataarea.RecId));
if (!dictTable.dataPrCompany())
{
info("Not percompany table");
}
else
if (xDataarea::find(common.dataAreaId).isVirtual)
{
select count(recid) from virtualDataAreaList where virtualDataAreaList.virtualDataArea == common.dataAreaId;
info(strFMT("table %1 contains %2 companies for virtual %3", dictTable.name(), virtualDataAreaList.RecId, common.dataAreaId));
}
else
{
info(strFMT("table %1 is not virtual for company %2", dictTable.name(), common.dataAreaId));
}
tick1 = WinApi::getTickCount();
i = 0;
for (i = 1; i < 20000; i++)
{
common2 = common.data(); // make a buffer copy
// also runs slowly with :
// common2 = conpeek(con, 1);
// common2 = map.lookup(1);
// every time you create an instance of buffer
}
tick2 = WinApi::getTickCount();
info(strFMT(
"time %1 steps %2 table %3 (company = %4)",
(tick2-tick1)/1000,
i,
dictTable.name(),
dictTable.dataPrCompany() ? common.dataAreaId : "No savePerCompany"
));
}