Thursday, July 1, 2010

Compare field list performance to '*'

A quick comparison between the venerable field list and our old friend the '*':


static void Nathan_FieldList(Args _args)
{
CustTable ct;
System.DateTime first, second;
System.TimeSpan ts;
str dummy;
;

flush CustTable;
first = System.DateTime::get_Now();
while select * from ct
{
dummy = ct.AccountNum;
}
second = System.DateTime::get_Now();
ts = second.Subtract(first);
info(ts.ToString());


flush CustTable;
first = System.DateTime::get_Now();
while select AccountNum from ct
{
dummy = ct.AccountNum;
}
second = System.DateTime::get_Now();
ts = second.Subtract(first);
info(ts.ToString());
}


Results:
00:00:27.6584672
00:00:05.3869224

That's 5.1 times quicker using the field list. Not bad.

No comments:

Post a Comment