|
For logging I recommend a ListBox, it will easily handle thousands of lines per second. See here[^].
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I need to display log events which are already collected in a generic list.
There are thousands of them, I'd like to explore the limits.
ListBox does not contain columns to show specific fields
Чесноков
|
|
|
|
|
Luc Pattyn wrote: . it is wise to use AddRange rather than Add, and
It will need to create a list of ListViewItems. Will it be faster than reporting from background worker item by item?
Чесноков
|
|
|
|
|
Luc Pattyn wrote: sometimes surround the entire operation with SuspendLayout/ResumeLayout
that is significantly slower than hiding the control
Чесноков
|
|
|
|
|
|
Which is exactly the answer I gave!
I must get a clever new signature for 2011.
|
|
|
|
|
|
|
Sorry, but this is not something I have ever used. I would suggest you open a new question so others will see it.
I must get a clever new signature for 2011.
|
|
|
|
|
|
|
Great, thanks, virtual mode is of value to handle large lists especially with large icons.
I will use it from now for those purpouses.
However I presume I will not be able to use virtual view for log event because the list with those events is not static.
There are many threads which use global logger class to report events. They are stored in a queue and once queue limit exceeds some constant 100,000 previous one is dequeued.
Log event addition is safe with lock.
It is possible that in virtual list view between RetrieveVirtualItem() calls threads may report dozens of new events, queue will move and it will end up of showing the same or odd events several times.
Чесноков
|
|
|
|
|
|
|
No you missed the point. No one was telling you they couldn't handle it, or that the controls could not support it. They have been telling you it is not a good design. And using the argument that Microsoft does it is not valid. The Event Viewer and such controls are written specifically for high performance situation in C++. You are not doing that are you?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
this entire thread got way too much attention...
do or do not, there is no try
|
|
|
|
|
because the topic is a challenge to display 100,000 in as little time as possible, and to find a user who may process them all
Чесноков
|
|
|
|
|
The common way is to load items which are currently visible (plus some more for a buffer) and continue loading items on demand as user scrolls the list down.
|
|
|
|
|
Preload entries for viewable area and maybe a little around, then load entries only when they should be shown. Cannot specify more concrete, haven't programmed for windows for years. NEVER ever do progress bars for filling controls, this nerves a lot especially if you clicked the wrong control, always use lazy loading. Java AWT is particularly good designed for this approach
|
|
|
|
|
I use the telerik winforms suite for similar operations, because it can
Telerik gridview
|
|
|
|
|
I met the similar problem.
Once I wrote a program for retrieving images from a website and I want that users can be notified about the downloading process, so I added a status bar on main GUI, and let the downloading process works on the other thread(let's say B), when it is retrieving the images , the B has to report its status to GUI which is on main thread(let's say A).
But B can not access the status bar which belongs to A. So there is a method call BeginInvoke(xxxx);
With this method, it enables B to access resourses on A.
So I think it should be the answer that you are looking for.
Give me reply whatever it works or not
cheers
|
|
|
|
|
You need to use background worker and report the progress with its ReportProgress() function.
Чесноков
|
|
|
|
|
Is the code calling BeginUpdate and EndUpdate? It might make a difference, but it's still going to be slow...
|
|
|
|
|
No, I set the list view Visible to false during events addition.
Otherwise the process is very slow.
Чесноков
|
|
|
|
|
Thanks for this question. I have an application with the same problem. The answers by some smart folks here are very helpful in solving this problem.
|
|
|
|