Re: Cracking DES with C++ is faster than Java?
From: Leor Zolman (leor_at_bdsoft.com)
Date: 04/27/04
- Next message: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Previous message: quahog: "java.net questions"
- In reply to: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Next in thread: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Reply: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Apr 2004 19:45:50 -0700
"Douglas A. Gwyn" <DAGwyn@null.net> wrote in message news:<yfqdnR1VhYEMGhDdRVn-gg@comcast.com>...
> Leor Zolman wrote:
> > Why do you say that? C++ was designed so as "not to leave room for a
> > lower-level language" (including C), so I can't imagine how anything you
> > code in C would become slower as a result of adaptation to / compilation
> > under C++ ... unless you go from a superior C compiler to an inferior C++
> > compiler, of course.
>
> C++ has several features that force the runtime to
> use more time. Just the need to run through the
> table of static initializers before beginning
> program execution is already a slowdown.
Okay, let's call that a possible one-time hit at start up, but
generally speaking you're going to pay the same start-up costs for
run-time initialization whether they end up being C++-style or
C-style.
> Functions
> generally have an extra (hidden) argument, which
> slows down function linkage.
You mean passing the "this" pointer? But that's just a matter of
semantics; if you need such a "parameter" in C, it goes into the
argument/parameter lists, and if you don't, neither do you need it in
C++ (you just use non-member functions)
> When virtual functions
> are involved, there is an additional slowdown.
And if you need a similar dispatch mechanism in a C program, it may
very well run even slower, but not likely any faster. Again, in C++
you don't pay for what you do not use or need. If you /need/ virtual
functions, you need that functionality. If not, you don't, and neither
do you pay for it.
>
> There is always room for a lower-level language.
> In the past couple of years much of my programming
> has been of necessity in assembly language!
There may be reasons to code something in assembly, but I still find
it difficult to believe that there would need to be room for /C/ in
any self-respecting C++ environment. And moving code from C to C++
should never incur any palpable performance penalty.
-leor
- Next message: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Previous message: quahog: "java.net questions"
- In reply to: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Next in thread: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Reply: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|