Hi, Mohit Rajvanshy,
If you want to perform a big size string operation that performance is an
important role, then you should use TextBuffer class. Just call appendText
method to concatenate the string.
I tried the class and the result is very significant. The results are 68
seconds using plus ('+') operator and 0 second using TextBuffer class.
Here is my code:
static void SWAStringConcatenationPerformance(Args _args)
{
TextBuffer tb;
str r,s;
int i;
int ts,te;
;
ts = winAPI::getTickCount();
s = 'My string for testing only.';
r = '';
tb = new TextBuffer();
for (i = 0; i < 30000; i++)
{
//r = r + s;
tb.appendText(s);
}
te = winAPI::getTickCount();
//info(tb.getText());
info (strFmt("Finished (%1 - %2 = %3, %4
seconds)",
te,ts,te-ts,(te-ts)/1000
));
}
//Finished (23366171 -
23297453 = 68718, 68,72 seconds)
//Finished (23407375 - 23407171 = 204, 0,20 seconds)
Good luck.
mohit rajvanshy
<[EMAIL PROTECTED]> wrote:
Hi All,
I am trying to fetch the records from a table
which is
having 30,000 + records. I am concatenating the
string. But it is taking too much time for this
operation. Any better idea to perform this
operation ?
TableBuffer tb;
str a;
;
while select tb
{
a = a +
tb.name;
}
Thanks in advance
Mohit
Regards
Mohit Rajvanshy
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com