POV-Ray : Newsgroups : povray.off-topic : Microsoft may have done something right... : Re: Microsoft may have done something right... Server Time
10 Oct 2024 17:19:28 EDT (-0400)
  Re: Microsoft may have done something right...  
From: Warp
Date: 22 Mar 2008 14:21:22
Message: <47e55c31@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> nemesis wrote:
> > *Anything* compiles extremely quickly compared to C++.  Just don't perform the
> > same.

> With JIT compilers and such, I'm not sure how you can be so sure. :-)

  I have no idea about the principles used in C#, but if it's anything like
Java, the biggest problem is not so much speed as memory usage. In Java
I don't think there's any way around the problem that you cannot create
a data container where each element takes as much memory as the total size
of the members of the object, nothing more. The smaller the object is, the
worse the memory usage overhead relative to this size.

  I actually find it a bit worrying that it seems that no programming
language introduced in the last 20 years which has got some popularity
seems to offer any tools *whatsoever* to create memory-efficient programs
(at least not without resorting to really ugly code which bypasses nice
modular design).

  Many people will say "that doesn't matter, memory amount is increasing
all the time". However, that's only a valid point for programs which use
a *fixed* amount of memory for what they do. In other words, a program
which required a fixed amount of 500 megabytes of memory when written in
a memory-efficient way in C++ 10 years ago may well run ok when written
in Java with a modern computer which has 4 gigabytes of RAM.

  However, it's rather rare that a program uses a huge amount of memory,
and that this amount is somehow fixed. The more usual case is that memory
usage is dynamic, and having more RAM in the computer will allow the program
to perform more than before. In other words, that program which 10 years
ago could perform a certain task with 500 MB of RAM may well be able to
perform a much larger task in a computer with 4 GB of RAM, while the java
version will only be able to perform the same task as the 10yo computer.

  In other words, the same program written in Java will be able to do
less than the version written in C++. And often you just *can't* create
a Java version which would be able to do the same things as the C++ version
with a given amount of memory, no matter what you try. (In some cases
similar memory usage may be achieved in Java, but at the cost of making
the code less modular and a lot more complicated.)

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.