Re: C# or C++ for Emulator?
- From: Andy McFadden <fadden@xxxxxxxxxx>
- Date: 14 Aug 2007 01:06:56 GMT
Eric <englere_geo@xxxxxxxxx> wrote:
Since C# is JIT compiled, you pay a penalty up front when a class is
entered but after that it's running as optimized native code. Since it
JITs on the target computer and not on the build computer it can even
optimize things in a target-specific manner. Most C++ compiles are
done to the lowest common denominator so they can't take advantage of
extra CPU features a given target may have. To be fair, I don't think
they fully utilize this yet but it's an interesting idea.
You pay a price for C# language overhead -- null pointer checks and such.
The "is JIT faster than native compilation" argument comes up enough that
there's probably a wikipedia page for it. C++ compilers generally have
architecture target flags that default to something relatively current.
You're not going to get the same level of performance out of JIT code
than you would native. However, you'll get the code finished faster and
you'll have fewer lurking bugs if you write it in Java or C# (though you
can cut down on these in native code with tools like valgrind).
Best approach is usually to write the app in the "higher level" language
and write the parts that need to be fast in the "lower level" language.
CiderPress would've been easier to write if I'd used C# (and some parts
of my sanity would not have been lost to MFC).
When you say "error trapping", do you mean "exception handling"? It
does not significantly slow down C# unless an exception is actually
thrown. I guess it's the same for C++ but I am not an expert on that.
If C# works like Java, there is zero overhead if an exception isn't thrown.
C++ exceptions incur a penalty whether they're used or not; code for
embedded systems usually compiles without exceptions to save both space
and time. The difference is largely due to the use of a garbage collector
vs. destructors -- Java doesn't have to explicitly clean up objects when
it rolls up the stack.
--
Send mail to fadden@xxxxxxxxxx (Andy McFadden) - http://www.fadden.com/
Fight Internet Spam - http://spam.abuse.net/spam/ & http://spamcop.net/
.
- References:
- C# or C++ for Emulator?
- From: Bryan Parkoff
- Re: C# or C++ for Emulator?
- From: Eric
- C# or C++ for Emulator?
- Prev by Date: Re: 16-pin game connector plugs with ribbon cable?
- Next by Date: Re: Beneath Apple Manor
- Previous by thread: Re: C# or C++ for Emulator?
- Next by thread: Vulcan
- Index(es):
Relevant Pages
|