|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Interestingly enough, when writing C# video games for the XBox, one
suggestion is to avoid allocating memory each frame. The GC engine on the
xbox apparently sucks, so if you're getting more than a handful of GCs per
minute, players are going to notice. So instead, you use things like points
and vectors and matricies and arrays of vertex structures and such, all of
which allocate on the stack without heap or pointers. That's something that
would be very difficult to do in Java, if it were possible at all.
--
Darren New, San Diego CA, USA (PST)
C# - a language whose greatest drawback
is that its best implementation comes
from a company that doesn't hate Microsoft.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Darren New <dne### [at] sanrrcom> wrote:
> Interestingly enough, when writing C# video games for the XBox, one
> suggestion is to avoid allocating memory each frame. The GC engine on the
> xbox apparently sucks, so if you're getting more than a handful of GCs per
> minute, players are going to notice. So instead, you use things like points
> and vectors and matricies and arrays of vertex structures and such, all of
> which allocate on the stack without heap or pointers. That's something that
> would be very difficult to do in Java, if it were possible at all.
If you are an expert and competent C++ programmer (especially a games
programmer), you have usually developed a natural way of thinking and
designing programs (especially ones requiring maximum efficiency) which
minimizes the amount of individual memory allocations, because 'news' and
'deletes' are heavy operations and you don't want a lot of those happening
each frame. In some situations this might result in slightly awkward
designs (where simplicity is somewhat being traded for memory usage
efficiency), but in many situations it is possible to write simple and
clean code which is at the same time efficient in this sense.
A Java programmer doesn't have to bother thinking about how many 'news'
he is writing, both because he can't really avoid them and because they
don't really matter all that much from an efficiency point of view (with
the possible exception of them causing somewhat more memory being allocated
than an equivalent well-designed C++ program would), and hence the mentality
regarding dynamic allocation is completely different.
I suppose, thus, that it's usually much easier for a competent C++
programmer to start writing efficient C# programs for the XBox than
for a competent Java programmer.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> I suppose, thus, that it's usually much easier for a competent C++
> programmer to start writing efficient C# programs for the XBox than
> for a competent Java programmer.
Well, I don't know about "efficient", but at least one that isn't
inefficient because it uses too much garbage collection. (Incidentally,
there really isn't any problem on Windows. It's just the "compact" .NET
framework that's a problem, if it's even a problem.)
I ran into a couple of places where I got caught/confused because I was
using arrays of classes (i.e., reference types) and I switched to using
structs (i.e., value types), and I tried to update things in place (which of
course failed). At which point I went "Oh *that's* what C++ references are
for..." Fortunately, I figured out what I had done after going "what in
the world did I change that could have broken *that* module?" for about 10
minutes.
--
Darren New, San Diego CA, USA (PST)
C# - a language whose greatest drawback
is that its best implementation comes
from a company that doesn't hate Microsoft.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|