Re: Cracking DES with C++ is faster than Java?

From: Julie (julie_at_nospam.com)
Date: 04/27/04


Date: Tue, 27 Apr 2004 08:38:22 -0700


"Douglas A. Gwyn" wrote:
>
> 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.

Just as slow as if a C program had registered an equal amount of startup
routines.

> Functions
> generally have an extra (hidden) argument, which
> slows down function linkage.

Standalone functions *never* have an extra hidden argument. Non-static class
member functions (methods) do have the 'this' pointer passed around as function
calls are made.

> When virtual functions
> are involved, there is an additional slowdown.

Not a slowdown, but a difference in behavior. You can't compare a regular (C)
function w/ a class method or virtual method, they just don't compare.



Relevant Pages