473,803 Members | 4,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Performance issue (bug?) with .NET 2 ListView

Are there any know bugs with the ListView in .NET 2? I'm having
problems with an application that takes 15 seconds in 1.1, and now
takes over a minute. The code in question uses:

listViewItem = this.listView1. Items.Add(...)

followed by 7 calls to

listViewItem.Su bItems.Add(...)

When I comment out this code, the application runs in the same time as
the 1.1 version.

Any suggestions? I can provide the source code if required.

May 31 '06 #1
18 1964
I would suggest a: using the ListViewItem ctor that allows you to specify
the sub-items in one go, and b: using the {Begin|End}Upda te syntax (around a
block of such) - i.e.

listview.BeginU pdate();
try {
ListViewItem newItem = new ListViewItem(ne w string[] {
"text1","text2" ,"text3","text4 "});
listview.Items. Add(newItem);
// and again...
// and again...
// and again...
// (or use AddRange)
} finally {
listview.EndUpd ate();
}

See if that works any quicker... you could also try {Suspend|Resume }Layout.

Marc
May 31 '06 #2
What's happening in .Add(...)?
Please post a complete sample that illustraties the issue, without seeing
any code it's hard to tell what's happening.

Willy.

<mr*********@go oglemail.com> wrote in message
news:11******** **************@ c74g2000cwc.goo glegroups.com.. .
| Are there any know bugs with the ListView in .NET 2? I'm having
| problems with an application that takes 15 seconds in 1.1, and now
| takes over a minute. The code in question uses:
|
| listViewItem = this.listView1. Items.Add(...)
|
| followed by 7 calls to
|
| listViewItem.Su bItems.Add(...)
|
| When I comment out this code, the application runs in the same time as
| the 1.1 version.
|
| Any suggestions? I can provide the source code if required.
|
May 31 '06 #3
try to add the subitems *before* you add the item to the istview

--
<mr*********@go oglemail.com> schrieb im Newsbeitrag
news:11******** **************@ c74g2000cwc.goo glegroups.com.. .
Are there any know bugs with the ListView in .NET 2? I'm having
problems with an application that takes 15 seconds in 1.1, and now
takes over a minute. The code in question uses:

listViewItem = this.listView1. Items.Add(...)

followed by 7 calls to

listViewItem.Su bItems.Add(...)

When I comment out this code, the application runs in the same time as
the 1.1 version.

Any suggestions? I can provide the source code if required.

May 31 '06 #4
It's over 6000 items I'm adding, here's a snippet:

ListViewItem listViewItem =
this.listView1. Items.Add(e.Req uestInfo.IP);
listViewItem.Su bItems.Add(e.Re questInfo.DateA ndTime.ToString ("U"));
listViewItem.Su bItems.Add(e.Re questInfo.TimeD ifference+ "");
listViewItem.Su bItems.Add(e.Re questInfo.Reque st);
listViewItem.Su bItems.Add(e.Re questInfo.Statu s+" ");
listViewItem.Su bItems.Add(e.Re questInfo.Bytes + "");
listViewItem.Su bItems.Add(e.Re questInfo.Refer er);
listViewItem.Su bItems.Add(e.Re questInfo.Brows er);

which is taken from a small project I'm writing, full source is at:

http://www.gotdotnet.com/Workspaces/...1-dbe878a161b7

May 31 '06 #5
I also tried changing

// ListViewItem listViewItem =
this.listView1. Items.Add(e.Req uestInfo.IP);
ListViewItem listViewItem = new ListViewItem(e. RequestInfo.IP) ;
this.listView1. Items.Add(listV iewItem);

and also used BeginUpdate,End Update but with no improvement

May 31 '06 #6
Items.AddRange( ) will be your friend.

If you use .NET2.0 the VirtualMode of the listview class could also be a
great idea.

--
<mr*********@go oglemail.com> schrieb im Newsbeitrag
news:11******** *************@j 55g2000cwa.goog legroups.com...
It's over 6000 items I'm adding, here's a snippet:

ListViewItem listViewItem =
this.listView1. Items.Add(e.Req uestInfo.IP);
listViewItem.Su bItems.Add(e.Re questInfo.DateA ndTime.ToString ("U"));
listViewItem.Su bItems.Add(e.Re questInfo.TimeD ifference+ "");
listViewItem.Su bItems.Add(e.Re questInfo.Reque st);
listViewItem.Su bItems.Add(e.Re questInfo.Statu s+" ");
listViewItem.Su bItems.Add(e.Re questInfo.Bytes + "");
listViewItem.Su bItems.Add(e.Re questInfo.Refer er);
listViewItem.Su bItems.Add(e.Re questInfo.Brows er);

which is taken from a small project I'm writing, full source is at:

http://www.gotdotnet.com/Workspaces/...1-dbe878a161b7

May 31 '06 #7
I should've posted the whole method, here it is:

private void OnLineMatched(o bject sender,LogReade rLineEventArgs e)
{
if ( this.InvokeRequ ired )
{
OnLineMatchedDe legate d1 = new
OnLineMatchedDe legate(OnLineMa tched);
this.Invoke(d1, new object[] { sender, e });
}
else
{
// ListViewItem listViewItem =
this.listView1. Items.Add(e.Req uestInfo.IP);
ListViewItem listViewItem = new ListViewItem(e. RequestInfo.IP) ;
listViewItem.Su bItems.Add(e.Re questInfo.DateA ndTime.ToString ("U"));
listViewItem.Su bItems.Add(e.Re questInfo.TimeD ifference + "");
listViewItem.Su bItems.Add(e.Re questInfo.Reque st);
listViewItem.Su bItems.Add(e.Re questInfo.Statu s + " ");
listViewItem.Su bItems.Add(e.Re questInfo.Bytes + "");
listViewItem.Su bItems.Add(e.Re questInfo.Refer er);
listViewItem.Su bItems.Add(e.Re questInfo.Brows er);
this.listView1. Items.Add(listV iewItem);
this.listView1. EndUpdate();

this.statusBar1 .Panels[1].Text = e.CurrentLine + "/" +
e.TotalLines;
this.progressBa r1.PerformStep( );
}
}

public class LogReaderLineEv entArgs : EventArgs
{
...
public ServerRequestIn fo RequestInfo
{
get
{
return this.serverRequ estDetails;
}
}
}

public struct ServerRequestIn fo
{
public DateTime DateAndTime;
public string IP;
public string Request;
public int Status;
public string Browser;
public string Referer;
public string Method;
public int TimeDifference;
public int Bytes;
}

May 31 '06 #8
The fact it's working in 15 seconds in 1.1 and 1 minute in .NET 2 seems
to point to something else I feel

cody wrote:
Items.AddRange( ) will be your friend.

If you use .NET2.0 the VirtualMode of the listview class could also be a
great idea.

--
<mr*********@go oglemail.com> schrieb im Newsbeitrag
news:11******** *************@j 55g2000cwa.goog legroups.com...
It's over 6000 items I'm adding, here's a snippet:

ListViewItem listViewItem =
this.listView1. Items.Add(e.Req uestInfo.IP);
listViewItem.Su bItems.Add(e.Re questInfo.DateA ndTime.ToString ("U"));
listViewItem.Su bItems.Add(e.Re questInfo.TimeD ifference+ "");
listViewItem.Su bItems.Add(e.Re questInfo.Reque st);
listViewItem.Su bItems.Add(e.Re questInfo.Statu s+" ");
listViewItem.Su bItems.Add(e.Re questInfo.Bytes + "");
listViewItem.Su bItems.Add(e.Re questInfo.Refer er);
listViewItem.Su bItems.Add(e.Re questInfo.Brows er);

which is taken from a small project I'm writing, full source is at:

http://www.gotdotnet.com/Workspaces/...1-dbe878a161b7


May 31 '06 #9
Just a thought:

Do you have any try catches that might be swallowing an exception?
Perhaps an exception is being generated and swallowed.

May 31 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5225
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and includes the following columns: DocID (INTEGER, PRIMARY KEY, CLUSTERED) IsRecord (INTEGER, NONCLUSTERED)
0
1260
by: Mortisus | last post by:
Hi, I'm running a fulltext query on a ~50000 record mysql database and while performance is usually satisfying - about 0.02 secs per query, i get a critical performance deterioration when looking for popular keywords (words that appear in more than 50% of the data) - about 0.25 secs/query. I know that the standard fulltext engine does not return any results on such words, and this is good, but this does not explain the performance issue....
1
1358
by: bob | last post by:
Currently i'm writing some low level communication modules in C++ and is thinking of putting it into a library so that it can be used in C#. My concern is the performance issue when putting C++ codes into C#. Does anyone has any idea(s) on this issue????
17
2070
by: 57R4N63R | last post by:
I'm currently building a website for one of the client. There has been few errors here and there, but just recently the problem is getting worse. Basically the symptoms is that when the user try to access the page, it takes really long time to load. However, after up to 1 hour, the website will run fine again as normal. This issue has been there with the site. I usually just ask the system admin to restart the IIS Service. However, the...
4
2239
by: Ira Siyal | last post by:
Hi I had a project in VB6 which I upgraded to VB.NET recently. In the app, I am facing some issue with listview control. In the earlier app, I have set the Icons in listview through an imagelist. but i notice that while i execute the project in .net, the step that sets the icon prop. throws an exception.
5
2033
by: Varangian | last post by:
Hi, I have a performance issue question? which is best (in terms of efficiency and performance, I don't care neatness in code)... building an ArrayList of Object Instances using SqlDataReader OR using SqlDataAdapter to Fill a DataSet or DataTable ? Thanks!
0
1486
by: Shades799 | last post by:
Hi All, I was wondering if any of you could help me with a very difficult problem that I am having. I have an ASP site that works with an Oracle database using an ADODB connection. This connection is stored in a .dll file. This site had been working fine. However recently we upgraded our Oracle database from 9i to 10g and ever since then we have been having serious performance problems with this site only. The website works fine...
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.