Performance slower in .Net FW 2.0

G

Guest

I am creating a new VB.Net Windows App project in VS 2005 and VS 2003 and
copying the code below into the Form1 class. If I compile as Release, and
run, I am seeing this app when run under .Net 2.0 (VS 2005) performing 3-4
times slower than the one compiled under .Net 1.1 SP 1 (VS 2003). Is there a
performance loss in .Net 2.0 for concurrent threads or the Interlocked
functionality?

Private Const MainLoopIterations As Long = 100L
Private Const ThreadIterations As Long = 1000000L

Private _ds, _de As DateTime

Private _total As Long
Private _lockObj As New Object

Protected Overrides Sub OnLoad(ByVal e As EventArgs)
MyBase.OnLoad(e)
RunTest()
End Sub

Private Sub RunTest()
_total = MainLoopIterations * ThreadIterations

_ds = DateTime.Now
For i As Integer = 1 To MainLoopIterations
ThreadPool.QueueUserWorkItem(AddressOf ThreadTestProcess, Nothing)
Next
End Sub

Private Sub ThreadTestProcess(ByVal state As Object)
For i As Integer = 1 To ThreadIterations
If Interlocked.Decrement(_total) = 0 Then
_de = DateTime.Now
Me.BeginInvoke(New EventHandler(AddressOf TestDone))
End If
Next
End Sub

Private Sub TestDone(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("Total time (ms): " +
_de.Subtract(_ds).TotalMilliseconds.ToString())
End Sub
 
P

Peter Huang [MSFT]

Hi,

Currently I am researching the issue and we will reply here with more
information as soon as possible.
If you have any more concerns on it, please feel free to post here.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steven Cheng[MSFT]

Hi jonathanokie,

We've performed some local tests and did reproduce the behavior. Currently
we've contacted the dev team on this and will update you when we got some
new info...
thanks for your understanding...

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| X-Tomcat-ID: 110220981
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) ("Peter Huang" [MSFT])
| Organization: Microsoft
| Date: Thu, 01 Dec 2005 05:45:19 GMT
| Subject: RE: Performance slower in .Net FW 2.0
| X-Tomcat-NG: microsoft.public.dotnet.framework
| Message-ID: <vO#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework
| Lines: 11
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.framework:104497
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi,
|
| Currently I am researching the issue and we will reply here with more
| information as soon as possible.
| If you have any more concerns on it, please feel free to post here.
|
| Thanks for your understanding!
|
| Best regards,
|
| Peter Huang
| Microsoft Online Partner Support
|
| Get Secure! - www.microsoft.com/security
| This posting is provided "AS IS" with no warranties, and confers no
rights.
|
|
 
P

Peter Huang [MSFT]

Hi

In the meanwhile the problem can be workarouned by declaring _total as int
instead of long.
In this way the code should be aligned to 8 bytes and then fix the
performance problem.
Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Peter,
In my tests I still see the .NET 2.0 version taking 1.3 times as long as the
..NET 1.1 version. Although not as severe, it still appears that .NET 2.0 is
running more slowly (I would say at a significant capacity). You may want
this information passed on to the dev team also.

Thanks,
Jon Okie
 
P

Peter Huang [MSFT]

Hi

Thanks for your reply, I have forward your feedback to our dev team.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top