Article View: alt.pl.comp.lang.csharp
Article #22388better performance for algorithm
From: kazik
Date: Thu, 26 Apr 2012 18:54
Date: Thu, 26 Apr 2012 18:54
21 lines
1870 bytes
1870 bytes
I have something like this:
DataTable t = new DataTable();
a.Fill(t);
for (int i = 0; i < t.Rows.Count; i++)
{
txt += "\n" + t.Rows[i][0] + "\t" + t.Rows[i][1] + "\t" + t.Rows[i][2]
+ "\t" + t.Rows[i][3] + "\t" + t.Rows[i][4] + "\t" + t.Rows[i][5] +
"\t" + t.Rows[i][6] + "\t" + t.Rows[i][7] + "\t" + t.Rows[i][8] + "\t"
+ t.Rows[i][9] + "\t" + t.Rows[i][10] + "\t" + t.Rows[i][11] + "\t" +
t.Rows[i][12] + "\t" + t.Rows[i][13] + "\t" + t.Rows[i][14] + "\t" +
t.Rows[i][15] + "\t" + t.Rows[i][16] + "\t" + t.Rows[i][17] + "\t" +
t.Rows[i][18] + "\t" + t.Rows[i][19];
}
I need this tabs between columns to generate txt file later.
Problem is that t.Rows.Count = 600000 and this loop works 9 hours.
Any ideas how to make this faster?
Regards
kazik
Technical Details
Message-ID:
<01555af6-7cde-4611-82f5-a4f97b81d87a@f37g2000yqc.googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!goblin1!goblin.stu.neva.ru!postnews.google.com!f37g2000yqc.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!goblin1!goblin.stu.neva.ru!postnews.google.com!f37g2000yqc.googlegroups.com!not-for-mail From: kazik <daniel.drwiega@gmail.com> Newsgroups: alt.pl.comp.lang.csharp Subject: better performance for algorithm Date: Thu, 26 Apr 2012 11:54:58 -0700 (PDT) Organization: http://groups.google.com Lines: 21 Message-ID: <01555af6-7cde-4611-82f5-a4f97b81d87a@f37g2000yqc.googlegroups.com> NNTP-Posting-Host: 46.148.153.215 Mime-Version: 1.0 X-Trace: posting.google.com 1335466612 23380 127.0.0.1 (26 Apr 2012 18:56:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 26 Apr 2012 18:56:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f37g2000yqc.googlegroups.com; posting-host=46.148.153.215; posting-account=3V1pcQoAAAAHz9wJHsZDKP5HqG1yA2Vq User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19,gzip(gfe) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit