BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delphi vs BCB ?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Non-Technical)
View previous topic :: View next topic  
Author Message
Sasan
Guest





PostPosted: Tue Sep 06, 2005 9:01 am    Post subject: Delphi vs BCB ? Reply with quote



Hello,
I hear that Delphi exe file are faster BCB,
becuse VCL write in Pascal language , is this true ?

regards,
m.t


Back to top
Andrue Cope [TeamB]
Guest





PostPosted: Tue Sep 06, 2005 9:32 am    Post subject: Re: Delphi vs BCB ? Reply with quote



Sasan wrote:

Quote:
Hello,
I hear that Delphi exe file are faster BCB,
becuse VCL write in Pascal language , is this true ?

Highly unlikely.

Although it's true that the VCL is written in Pascal (Borland's Delphi
dialect of it) it compiles to 80x86 machine code just as C++ code does.
Delphi as a language is not particularly innefficient so the resulting
DLLs/LIBs that we link to probably execute at the same speed as if
they'd been written in C++. Some C++ code had to be written to provide
an interface between us and the VCL but this is minimal code (mostly
just wrappers) and unlikely to impact on performance.

If there are any performance issues associated with the VCL they are
almost certainly dwarfed into insignificance by the message handling
aspect of the Windows GUI. No-one expects lightening fast instantaneous
response from a GUI so a few extra function calls or poorly implemented
functions are unlikely to have any effect on the user experience.

The only real downside to the use of Delphi for the VCL is that a few
C++ design paradigms aren't directly available to us and we are tied
into Borland's products. In practice I don't imagine that C++
developers are continuously being stymied by not being able to employ
multiple inheritance and std::auto_ptr lets us put components on the
stack for most practical purposes. Actually multiple inheritence may be
available in the next version since I think I heard that the Delphi
language now supports it.

Being tied into Borland products can at times seem like a real problem.
The sad neglect of BCB until recently is perhaps the worst example of
the consequences of this. Thankfully Borland are now working to correct
that issue and based on past experience the result should be just about
enough to get most of us back on their side.
--
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html

Back to top
Alisdair Meredith [TeamB]
Guest





PostPosted: Tue Sep 06, 2005 11:36 am    Post subject: Re: Delphi vs BCB ? Reply with quote



Andrue Cope [TeamB] wrote:

Quote:
Actually multiple inheritence may be available in the next version
since I think I heard that the Delphi language now supports it.

Delphi supports implementing multiple interfaces, much like Java. BCB
gained the ability to support multiple base classes for VCL in BCB6 so
long as:

i/ only one base class is derived from TObject.
(and I think it must be first/leftmost class)

ii/ all other classes are 'interface' classes.
The definition of interface in this case is all members are pure
virtual functions, without an implementation.

Given TObject destructor uses __fastcall convention, it is recommended
to defined your interface class destructors as virtual __fastcall as
well. [I think you are allowed to implement this destructor inline]

Note there are still problems with dynamics casts on the interfaces,
but it will serve for most purposes where an interface class is
desirable.

As far as I am aware, there are still no plans for 'mixin' class
support for VCL multiple inheritence.

And of course, these restrictions are purely on classes with VCL base
classes - straight C++ has no such restriction.


AlisdairM(TeamB)

Back to top
Rudy Velthuis [TeamB]
Guest





PostPosted: Tue Sep 06, 2005 11:53 am    Post subject: Re: Delphi vs BCB ? Reply with quote

At 11:32:09, 06.09.2005, Andrue Cope [TeamB] wrote:

Quote:
Actually multiple inheritence may be available in the next version since
I think I heard that the Delphi language now supports it.

Not at all. I think Alisdair explained it very well for the C++ side of
TObject-derived classes.
--
Rudy Velthuis [TeamB] http://velthuis.homepage.t-online.de

"A scholar who cherishes the love of comfort is not fit to be deemed a
scholar."
-- Lao-Tzu (570?-490? BC)

Back to top
Robby Tanner
Guest





PostPosted: Tue Sep 06, 2005 3:42 pm    Post subject: Re: Delphi vs BCB ? Reply with quote

I believe Delphi apps will compile in single pass, so I imagine they build
faster. Not so sure about execution profiles though.

Rob

"Sasan" <sasan_vm (AT) yahoo (DOT) com> wrote

Quote:
Hello,
I hear that Delphi exe file are faster BCB,
becuse VCL write in Pascal language , is this true ?

regards,
m.t




Back to top
Helmut Giese
Guest





PostPosted: Tue Sep 06, 2005 4:04 pm    Post subject: Re: Delphi vs BCB ? Reply with quote

On Tue, 6 Sep 2005 13:31:27 +0430, "Sasan" <sasan_vm (AT) yahoo (DOT) com> wrote:

Quote:
Hello,
I hear that Delphi exe file are faster BCB,
becuse VCL write in Pascal language , is this true ?
For the VCL doing lots of GUI stuff this will probably not matter, but

by (language) design Pascal problems will run a trifle faster than
their C equivalent, because in Pascal the caller is responsible for
clearing the stack.

In C any function just ends with
return
and the the caller adjusts the stack by doing
add sp,xxx
to remove the parameters it pushed before calling the function.

In Pascal a function having parameters ends with
return xxx
which returns to the caller and at the same time removes those xxx
bytes from the stack, and this gains a tiny little bit of time at each
function call.

A consequence of this is btw that in Pascal you cannot have (user
defined) functions with a variable number of arguments (think printf
in C). Yes, you have WriteLine but the compiler /knows/ that it is
special - /you/ cannot define a similar function.

But I wouldn't take this as a criterion when choosing a language.
Best regards
Helmut Giese

Back to top
Helmut Giese
Guest





PostPosted: Tue Sep 06, 2005 4:15 pm    Post subject: Re: Delphi vs BCB ? Reply with quote

An afterthought:
Of course Delphi /compiles/ blazingly fast. The reason for this is
that Delphi is totally proprietary, no standard in sight to conform
to.

A C compiler has to #include, say windows.h (ever looked at its
size?), and interprete and remember any definition it contains -
whether it will actually be used by your program or not.

In Delphi the equivalent is 'using MyUnit'. Now, MyUnit only contains
information about the things it /actually/ 'exports' - and this in a
proprietary way which is probably optimized for speed. So the Delphi
compiler looks at MyUnit, collects the couple of functions etc. it
exports and is done with the whole compilation, while the C compiler
is still grinding through the header files.

HTH
Helmut Giese
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Sep 06, 2005 6:42 pm    Post subject: Re: Delphi vs BCB ? Reply with quote


"Sasan" <sasan_vm (AT) yahoo (DOT) com> wrote


Quote:
I hear that Delphi exe file are faster BCB,
becuse VCL write in Pascal language , is this true ?

It is not the coding language persay that determines the runtime speed.
Both languages compile to 8x86 assembly instructions, so the speed of
runtime executation of various commands is similar. BCB apps, however, tend
to be a little slower than Delphi apps because C++ apps have more runtime
overhead then Delphi apps. Not only do C++ VCL apps have the VCL library to
deal with, but they also have the C/C++ runtime library to deal with as
well.


Gambit



Back to top
Robby Tanner
Guest





PostPosted: Tue Sep 06, 2005 11:46 pm    Post subject: Re: Delphi vs BCB ? Reply with quote


"Helmut Giese" <hgiese (AT) ratiosoft (DOT) com> wrote

Quote:
On Tue, 6 Sep 2005 13:31:27 +0430, "Sasan" <sasan_vm (AT) yahoo (DOT) com> wrote:

A consequence of this is btw that in Pascal you cannot have (user
defined) functions with a variable number of arguments (think printf
in C). Yes, you have WriteLine but the compiler /knows/ that it is
special - /you/ cannot define a similar function.

Really? Hm. I thought you could.



Back to top
Lee Grissom
Guest





PostPosted: Wed Sep 07, 2005 12:50 am    Post subject: Re: Delphi vs BCB ? Reply with quote

"Robby Tanner" wrote
Quote:
I believe Delphi apps will compile in single pass, so I imagine they build
faster.

No need to imagine. Delphi compiles *a lot* faster.
--
Lee



Back to top
Andre Kaufmann
Guest





PostPosted: Wed Sep 07, 2005 5:31 am    Post subject: Re: Delphi vs BCB ? Reply with quote

Remy Lebeau (TeamB) wrote:
Quote:
"Sasan" <sasan_vm (AT) yahoo (DOT) com> wrote in message
news:431d5ab4 (AT) newsgroups (DOT) borland.com...


I hear that Delphi exe file are faster BCB,
becuse VCL write in Pascal language , is this true ?


It is not the coding language persay that determines the runtime speed.
Both languages compile to 8x86 assembly instructions, so the speed of
runtime executation of various commands is similar. BCB apps, however, tend
to be a little slower than Delphi apps because C++ apps have more runtime
overhead then Delphi apps. Not only do C++ VCL apps have the VCL library to
deal with, but they also have the C/C++ runtime library to deal with as
well.


I agree that the C++ runtime library needs additional memory and perhaps
some additional time on startup / initialization. The additional code
(size) may have an impact on the speed. But i cannot imagine why the C++
runtime would have another impact on the speed of the application ?
If I don't use the C++ runtime and only VCL code I don't see any reason
why Delphi should generate (significant) faster code.

- calling convention is the same
- code (VCL) is the same


Quote:

Gambit


Delphi surely generates the code faster ;-)

In both languages you can write bad code and e.g. code that uses
standard C++ iostreams for file io tends to be rather slow.

Andre


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Sep 07, 2005 5:35 am    Post subject: Re: Delphi vs BCB ? Reply with quote


"Andre Kaufmann" <andre.kaufmann.bei (AT) t-online (DOT) de> wrote


Quote:
If I don't use the C++ runtime and only VCL code I don't see
any reason why Delphi should generate (significant) faster code.

Even if you don't use the C++ runtime in your own code, it is still being
used nontheless. The C++ portions of the VCL use it, and maybe also the
startup code. Also, things like ATL also use the runtime internally in
places.


Gambit



Back to top
Andre Kaufmann
Guest





PostPosted: Wed Sep 07, 2005 5:43 am    Post subject: Re: Delphi vs BCB ? Reply with quote

Helmut Giese wrote:
Quote:
On Tue, 6 Sep 2005 13:31:27 +0430, "Sasan" <sasan_vm (AT) yahoo (DOT) com> wrote:


Hello,
I hear that Delphi exe file are faster BCB,
becuse VCL write in Pascal language , is this true ?

For the VCL doing lots of GUI stuff this will probably not matter, but
by (language) design Pascal problems will run a trifle faster than
their C equivalent, because in Pascal the caller is responsible for
clearing the stack.


Are you sure that the calling convention has that significant impact on
the execution speed of the compiled code ?
I doesn't matter if the called function or the caller saves/removes it's
arguments to/from the stack.
What matters is the code size generated, which is larger if the __cdecl
calling convention is used and a function is called multiple times, so
far you are right that the C++ code may run not that fast than the one
compiled with Delphi.

But you are free the choose any calling convention you like in your own
code and regarding 64 Bit compilers you won't have to care about calling
convention anymore Wink.


Quote:
[...]
But I wouldn't take this as a criterion when choosing a language.

The compiler which has an overview of all the code compiled can choose
the calling convention by itself and can pass most of the parameters in
registers.

Quote:
Best regards
Helmut Giese

Andre

Back to top
Robby Tanner
Guest





PostPosted: Wed Sep 07, 2005 3:32 pm    Post subject: Re: Delphi vs BCB ? Reply with quote


"Andre Kaufmann" <andre.kaufmann.bei (AT) t-online (DOT) de> wrote

Quote:
Helmut Giese wrote:
On Tue, 6 Sep 2005 13:31:27 +0430, "Sasan" <sasan_vm (AT) yahoo (DOT) com> wrote:

But you are free the choose any calling convention you like in your own
code and regarding 64 Bit compilers you won't have to care about calling
convention anymore Wink.

Why not?




Back to top
Andre Kaufmann
Guest





PostPosted: Thu Sep 08, 2005 8:39 pm    Post subject: Re: Delphi vs BCB ? Reply with quote

Robby Tanner wrote:
Quote:
"Andre Kaufmann" <andre.kaufmann.bei (AT) t-online (DOT) de> wrote in message
news:431e7db4 (AT) newsgroups (DOT) borland.com...

Helmut Giese wrote:

On Tue, 6 Sep 2005 13:31:27 +0430, "Sasan" <sasan_vm (AT) yahoo (DOT) com> wrote:

But you are free the choose any calling convention you like in your own
code and regarding 64 Bit compilers you won't have to care about calling
convention anymore Wink.


Why not?


There's only one calling convention in 64 bit Windows - __fastcall

Andre

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Non-Technical) All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.