No idea what you are talking about.
Where are you pulling THIS stuff from?
I'd say so.
No idea what does recursion has to do with it.
Java has recursion. Moreover, there are functional languages built on the Java
platform.
Recursion is not directly connected to the need for garbage collection; this is
some kind of strange misconception.
I would think recursion has 0 impact on GC from what I see.
GC is very efficient from an SMP point of view, because it allows
for immutable objects to be truly immutable, over most of their
lifetime. No book-keeping operations have to be performed on objects
that are just passed around throughout the program (such as bumping
refcounts up and down).
No storage reclamation strategy is free of overhead. Even if your program
correctly manages memory by itself with explicit new and delete, there is a
cost.
Moreover, a poorly implemented heap allocator (like virtually
every default malloc implementation out there in the real world)
is an SMP performance killer.
Like malloc and new, GC can be badly implemented in a way that kills SMP
performance. So can any aspect a programming language implementation, including
the compiler.
If you find a sufficiently bad compiler and library for some language, you can
``prove'' any statement about how bad that language is.
That may be so, but GC does not require a virtual machine. GC has been used for
five decades, with natively compiled code, starting in the late 1950's on IBM
704 mainframes, as part of the Lisp run-time support.
Unfortunately, that is wishful thinking. Natively compiled Java
has very little disadvantage compared to C and C++.
(Mainly in areas of doing low-level things
with memory, or directly interfacing with the ``bare iron''; the sorts
of things that are poorly supported in Java).
Correct.
Java has the same low-level numeric types, and the way it deals with
objects is not much different from pointers to classes in C++.
Indeed. And once you deal with objects, ALL the "advantages"
in performance of C++, or even C, are gone, and you are on the
same level, if not better, depending on what kind of algorithms
are implemented to handle things like collections, such as list,
tree, hash map, map, etc.
In real programs, you don't deal with bits and bytes and register
values. You deal with OBJECTS. Once you deal with objects and do
just about any operation on them of any significance, all your
"performance" gains are gone. Non existant.
There is no reason to expect something like a matrix multiplication with
Java arrays to be slow, when Java is compiled to native code by an optimizing
compiler.
Interesting point people seem to miss is that overall performance,
people seem to miss is that the overall advantage of having a JVM
is shielding you from all sorts of nasty problems when you
have to deal directly with O/S and provides you a portability
mechanism, so if you decide to wire in the GUI, threads, gc or
whatever, you don't have to worry about how it is going to run
on a different platform.
The cost of JVM in terms of memory footprint is negligible
by today's standards. Probably 10 - 15 % of your total memory
requirements for more or less complex apps that are useful
enough to even bother about.
Another point about performance is if your language has a rich
set and enough of expressive power so you do not incure that
much performance overhead. Overall impact on your performance
I'd estimate to be no more than 10-20%, probably in the worst case.
I'd be curious to see the benchmarks.
You incure performance overhead when you do lil things on a
very low level, poking into memory or what have you.
You'd have to substantiate your claims with some hard data,
and even there, it highly depends on what kind of things
your app does.
I my case, I have not noticed ANY issues with performance.
I am processing at least 1000 of articles per second, and
even that is not the limit because of my overly defensive
coding style for reading file. I bet I can double that
performance if I spend a couple of days, if not couple of
hours on it. It think at least 30 to 50% is quite realistic.
The way I check it, is to see how fast my app is processing
files by simply looking at the rate at which my drive light
flashes. In a perfect app, it would stay solid red with
very little flashing. That means it achieved a PERFECT
performance or theoretical limit, bound by disk i/o.
In my case, it does not. So, in my case, I am processing the
stuff at a rate equivalent to about 6 megs per second in
terms of disk access speed. Considering the amount of
processing going on under the hood, I'd like to see YOUR
app doing better using C++.
And what is going on during the processing is this:
you read each text line, pass it to the article parser
engine. That one detects various article headers,
saves them in the object to generate an article object.
Once the article is parsed, the filtering engine kicks
in to filter the articles on anything you can imagine,
including the article headers and article body, a pretty
heavy duty filter.
THEN, two indexes are constructed on the fly, by message
ID and by article date stamp. A typical operation
processes at least 100k articles. So, just to construct
a sorted index on that many articles is quite a trip
by itself.
So, if you consider that overall speed of processing
is not far from direct disk read, such as in file copy,
then that is good enough for a poor guy like me.
I bet you can't do it faster in C++, no matter WHAT you do.
Prolly 10-20% is the best case.
But...
What I get in return is to be able to write the GUI code
with a single language, without worrying about all sorts
of graphics toolkits. I do not have to worry about threads.
I know it will run on any platform where you can install
JVM. I have a pretty rich set of language. Just collections
alone, out of the box is all I needed to date.
And I don't have to worry of someone's toolkit or library,
all of a sudden, will either becomes a closed source, or
stops being maintained and develop. And I don't have to
worry whether there IS such a toolkit on a different
platform of IDE environment or not.
I am not even using the Java preferred IDE, becase I don't
like any of them. Just code completion alone, is my MAJOR
concern, and I mean code completion from the moment you
type your first character, that is able to recognize what
are the valid symbols in the scope I am in.
I can crank out the code probably twice as fast as they
can on those IDEs. Well, I did not try to compete with
anyone, but just for the sake of arguments. Sure, IDE
alone is not enough to achive such results. But, combined
with code design and architecture issues, a typical
significant program update, where some more or less
major functionality added, take a couple of days on average.
I don't rememober a case where I had to spend more than
a week, and I mean thing so radical, that I had to modify
at least 10 source files and change all sorts of GUI
code in several panels.
And THAT is what I am after. An OVERALL performance of
development cycle, portability, the amount of worrying,
the clarity of syntax and language notation.
I do not even use generics. A matter of principle.
I personally think it is one of the worst ideas in Java
since the day one. Most of it is bluff that translates
in orders of magnitude increase in complexity in terms
of being able to quickly read your code and understand
what it does.
I work on my code by looking at some scren for a couple
of seconds and I can see what is going on there.
I do not need to spend half an hour staring at some
hieroghlyphs from Martians. I don't have that time.
My brain is not overloaded with all sorts of useless
bells and whistles, taking most of my brain processing
time just to understand those utterly unintuitive
constructs and tricks.
So far, never regretted it.
In other words, just about ALL I have to worry is a single
something, a single language, a single syntax, a single
set of tricks.
Just the fact of me being able to run my app on Windows
and linux without even recompiling it, as I did,
wins the argument hands down, no matter what kind of artument its.
Simple as that.
But that is for ME. Not for you.
For you, I can only wish good luck.
--
Programmer's Goldmine collections:
http://preciseinfo.org
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.