|
In fact, I did see clear speed improvements in other code (could very well have been 60% or more) but this was running on a dedicated thread.
All the code that has become slower either runs on a ThreadPool thread (so with background priority) or is called in the Paint event.
Meanwhile, I found that the slowdown is not being caused by any GDI+ methods nor probably any other specific framework things that I am using.
I am starting to suspect that from .Net 1.1 to 2.0 something has changed in the amount of priority given to background threads and/or Paint events.
Does anybody know of this?
|
|
|
|
|
I don't know anything about the priority for background threads, but I know that the Paint event is not run in a separate thread at all, but in the main thread of the application. The paint event goes through the regular message pump of Windows, so that hasn't changed at all. If the priority level of background threads has changed, that would of course be relative to the main thread, including the paint event.
Are you using any locking in your code? The code itself should not be running slower, so perhaps the threads are spending more time waiting for each other?
---
b { font-weight: normal; }
|
|
|
|
|
Amazing discovery:
The slowdown was not at all being caused by threading issues but by the fact that I was using jagged Object arrays and forgot to use CType when assigning values from the array to a (typed) variable.
I know it's not ideal to use the object type, but under .Net 1.1 this was certainly going a lot faster.
Anyway, the speedup by simply using CType (once for typing the object array as Object() and once more for typing the indexed element of that array as the correct type) is amazing, could be 1000%.
Thanks for the remark about the Paint event, that was useful to know in eliminating possible causes.
Jim
|
|
|
|
|
I see... so it added an implicit conversion, which is slow because it has to take any possible data type in consideration. VB is so helpful to add bad code instead of telling you that your code is wrong.
Use DirectCast instead of CType if you only want to specify the data type of existing data, and don't want to do any conversion. It's faster, and the code gets clearer.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: Use DirectCast instead of CType if you only want to specify the data type of existing data, and don't want to do any conversion. It's faster, and the code gets clearer.
How much faster? I'm in a VB dev team here and we all use CType, as does the inherited codebase we're all working on. I read that DirectCast is faster. Any idea how much faster? I've not used it in case my co-developers find it odd.
Kevin
|
|
|
|
|
I was wondering if any of you could pass me a simple program for visual basic .NET, a very simple one, just using commands, like if, select case, strings, or cycles. I need desperate help with this, if any of you cold pass me a program send it to my email adress, lfpmx@msn.com. I would be grateful if you could help me with this, is very important. Thanks all of you for your help.
|
|
|
|
|
Why is that so very important?
I don't see how a program that doesn't do anything specific could be important for any real implementation. Is this a homework assignment that you are trying to make others do for you?
Anyway, expect replies in the forum, not to your email. The purpose of a forum is that people can cooperate to find an answer, and that other people than only you can benefit from it.
Also, try to write a subject that does anything towards distinguising the thread from other threads. Almost every thread in here is about someone who needs help, so that information is completely useless. Writing the subject in all capitals and appending it with a ridiculous amound of exclamation marks does not help.
---
b { font-weight: normal; }
|
|
|
|
|
lfpmx wrote: I was wondering if any of you could pass me a simple program for visual basic .NET, a very simple one, just using commands, like if, select case, strings, or cycles. I need desperate help with this, if any of you cold pass me a program send it to my email adress, lfpmx@msn.com. I would be grateful if you could help me with this, is very important. Thanks all of you for your help.
What is it that you are specifically having trouble with?
If you try to write that in English, I might be able to understand more than a fraction of it. - Guffa
|
|
|
|
|
Tell us how to help, we can't just pop a program out of mid air for you. If you have questions about statements, make a list and everyone will answere them, this should give you a good understanding, also if you have limewire or something similar, try downloading visual bas for dummies book/document, This will help a great deal.
Posted by The ANZAC
|
|
|
|
|
How can you be "desperate" when you don't even describe any specific problem you want solved?
Kevin
|
|
|
|
|
Actually he didn't say that he is desperate, he only said that he needs "desperate help", what ever that is...
---
b { font-weight: normal; }
|
|
|
|
|
I stand corrected.
Kevin
|
|
|
|
|
lfpmx wrote: just using commands, like if, select case, strings, or cycles.
What on earth are cycles ?
The point of a class is that it gives you the info you need to complete an assignment. Ask your class mates if they are able to do the work. If so, then consider doing some extra work to catch up, and paying attention in future, or consider dropping the class and taking up pottery or something instead.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: What on earth are cycles?
I guess that they are loops.
---
b { font-weight: normal; }
|
|
|
|
|
Christian Graus wrote: The point of a class is that it gives you the info you need to complete an assignment.
And I always thought classes are used to group related variables and functions.
Christian Graus wrote: Ask your class mates
You probably mean internal classes?
Christian Graus wrote: consider dropping the class
But beware that the designer only allows classes inheriting from Component to be dropped onto a form.
Robert
|
|
|
|
|
hi,
Please check for the following:
if this.text = "" then
lable.visible = False
end if
for i = 1 to 10
i > 0;
i++
Success is 99% failure
|
|
|
|
|
Hello,
I have a problem...i have a messenger like MSN in which when the user clicks the cross(close) sign on the main window after signing in, the application does not exit, but hides to the system tray. This works fine, on the "On closing" event, i canceled the closing process and hid the form with Me.hide or me.visible = false.
When the user opens a new chat window, and then presses the close sign, the main messenger form hides perfectly but it also hides the chat forms open! I want that the main form hides only adn the chat forms remain in view...how do i go abt doing that? The main messenger form opens the chat window...
|
|
|
|
|
The other windows close as the main window is their parent. The easiest solution is to make them siblings, I would think.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
Is it possible to make sure that your form is alway's topmost?
I have a situation where a side-bar gets 'topmost' my form.
With regards,
Jurgen
|
|
|
|
|
tessers wrote: Is it possible to make sure that your form is alway's topmost?
Set the TopMost property to true ...
If you try to write that in English, I might be able to understand more than a fraction of it. - Guffa
|
|
|
|
|
Thanks for the answer, but what if another application have the topmost property set to true and starts after my application?
With kind regards,
Jurgen
|
|
|
|
|
Then that window would be on top of yours, but still your form remains on top of other windows.
To make your form really ALWAYS on top, you sould check it periodically using a Timer ( Or maybe I guess OnPaint Event of your form).
|
|
|
|
|
Oke, thanks Mohammad. I will give it a try.
|
|
|
|
|
I am a beginner to visual basic, but i wanted to know where do i start when trying to build an application for sending a general email.
jgreen29
|
|
|
|
|
How can I see what threads are currently running in my vb.net 2005 project?
thank you
|
|
|
|