Perfomance using .NET vs. Borland

T

TGF

I am wondering if it is feasible to use .NET for applications that have to
be very fast. We have a few applications that are blazingly fast, written
in Borland C++ using Borland C++ Builder. We would like to port over to
..NET, but some of the test models we have developed are MUCH, MUCH slower
than it's Borland counterpart. Is this due to the .NET Framework and the
JIT? Or is it something we should be looking for in the project settings
and/or compiler settings? The performance decrease is about two-fold.
 
P

Peter van der Goes

TGF said:
I am wondering if it is feasible to use .NET for applications that have to
be very fast. We have a few applications that are blazingly fast, written
in Borland C++ using Borland C++ Builder. We would like to port over to
.NET, but some of the test models we have developed are MUCH, MUCH slower
than it's Borland counterpart. Is this due to the .NET Framework and the
JIT? Or is it something we should be looking for in the project settings
and/or compiler settings? The performance decrease is about two-fold.
What kind of applications are we talking about? Windows, console, etc.?
You are aware that you aren't limited to .NET Framework-dependent
application types in Visual Studio .NET, correct? IOW, you can create
straight Windows API applications, or MFC applications, or straight console
applications. You may be comparing apples to oranges.
 
T

TGF

Peter,

I am talking about a .NET Windows Form C++ Application using the managed
extensions. Specifically, I have a RichTextBox component that is to be
updated, line by line very very quickly. In the Borland C++ Builder app I
have created, it is blindingly fast (this is good). In the .NET Windows
Forms application, it is painfully slow. The code is pretty much the same,
albeit compensating for the managed extensions in .NET. Is this slowdown to
be expected (due to the .NET framework), or am I missing something?

-TGF
 
P

Peter van der Goes

TGF said:
Peter,

I am talking about a .NET Windows Form C++ Application using the managed
extensions. Specifically, I have a RichTextBox component that is to be
updated, line by line very very quickly. In the Borland C++ Builder app I
have created, it is blindingly fast (this is good). In the .NET Windows
Forms application, it is painfully slow. The code is pretty much the same,
albeit compensating for the managed extensions in .NET. Is this slowdown to
be expected (due to the .NET framework), or am I missing something?

-TGF
I'm still confused. You're building a Visual Studio .NET 2003 C++ Windows
Form template application, and comparing it to what type of application
produced in Borland C++ Builder? What technology does the Borland app
employ? OWL? MFC? API calls?
Regardless, I'm probably not the right person to address your question, as
all I can provide is limited, anecdotal evidence of a few test WinForm apps
that employ textboxes, single and multi-line, rich text boxes, list boxes,
etc that don't show any noticeable performance deteriorations in comparison
to earlier examples using MFC. That doesn't mean it can't happen, but
someone would have to look at exactly what is going on in your application
to provide a meaningful response.
Hopefully, someone else with more specific experience will jump into the
thread.

--
**********************************************************************
** All opinions are mine alone.Do not attribute elsewhere!
**********************************************************************
** Peter van der Goes, Professor, Computers & Information Technology
** Rose State College
*********************** Contact ************************************
** Office e-mail: (e-mail address removed)
** Home e-mail: (e-mail address removed)
** Web Page: http://www.rose.edu/Faculty/pvan/index.htm
**********************************************************************
 
M

Michael Giagnocavo [MVP]

AFAIK, Windows Forms (at least parts of System.Drawing) don't get hardware
accelleration. This is based on old information, so it might be incorrect
:S.

Are you using the same control in both scenarios? Are you sure you don't
have any optmization code in your Borland project that's helping out?

For updating a control, I'd recommend disabling repainting of it, update it,
and then repaint it. Making it perform multiple repaints in rapid
succession can be rather slow.

-mike
MVP

TGF said:
Peter,

I am talking about a .NET Windows Form C++ Application using the managed
extensions. Specifically, I have a RichTextBox component that is to be
updated, line by line very very quickly. In the Borland C++ Builder app I
have created, it is blindingly fast (this is good). In the .NET Windows
Forms application, it is painfully slow. The code is pretty much the same,
albeit compensating for the managed extensions in .NET. Is this slowdown to
be expected (due to the .NET framework), or am I missing something?

-TGF


have
 
P

Peter van der Goes

Michael Giagnocavo said:
AFAIK, Windows Forms (at least parts of System.Drawing) don't get hardware
accelleration. This is based on old information, so it might be incorrect
:S.

Are you using the same control in both scenarios? Are you sure you don't
have any optmization code in your Borland project that's helping out?

For updating a control, I'd recommend disabling repainting of it, update it,
and then repaint it. Making it perform multiple repaints in rapid
succession can be rather slow.

-mike
MVP
Mike, perhaps you can clear something up for me.
I was under the impression that the OP was using the new Windows Form
Application (.NET)template in VS.NET 2003 and comparing the "slowness" of it
to a similar project built in Borland C++ Builder. I did a little research
on C++ Builder, and did not see any indication that it supports the .NET
framework (at least not so stated on the Borland product page), let alone
feature an analog to the Windows Form (.NET) template? That's why I wanted
the OP to tell us if he was using OWL, MFC or whatever. Am I out in left
field on this?
Thanks in advance.
 
M

Michael Giagnocavo [MVP]

I don't know much about Borlands solutions either (but I do believe they
have some .NET offering). I do know that Windows Forms wraps some common
controls with a layer of managed code. I guess I'm seconding your question
about the actual environment to make sure this is an apples to apples
comparison.

-mike
MVP
 
T

TGF

Guys:

The Borland environment I was using is basically a "Non .NET" forms
based IDE. The support for form in Borland Builder seems to be much better.
The Borland classes that make it possible are basically wrappers around MS
MFC's. Not my choice to switch to .NET, but have to go with it nonetheless.
It seems maybe because of the .NET framework (MSIL use), the RichTextBox
component is not able to AppendText() as quickly as it's MFC counterpart.
Is this the case that you guys see? I did a test with a Timer component
calling a Tick event every 1ms. This is a bare bones form that I did the
test on. The RichTextBox was able to do about 100 lines a second compared
to about 500 lines a second using Borland C++ Builder.

-TGF
 
M

Michael Giagnocavo [MVP]

You could try disabling or making it invisible. If not, try subclassing it,
override the Paint method and add a boolean property "IsUpdating". While
it's updating, you don't paint.

I'm curious as to why you are adding new text to an RTFBox so quickly?
Couldn't you buffer your output and then write a large chunk every few
seconds or more?

-mike
MVP
 
T

TGF

Mike,

The reason I have to update it so quickly is because it is reading data in a
binary form from a flat file that has an internal directory structure....So
while it is possible to and might be the only solution, to update every 10
lines or so, it would be MUCH nices to have a line by line output, but thats
the breaks, I guess.
 

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