views:

431

answers:

7

Writing fast native applications, with API calls and etc, in a modern cross platform programming language like C# would be awesome, wouldn't it? For example if you want to write a simple utility for helping IT people with installing things, which wouldn't need another components, in an easy and modern programming language? or if you want to write a 3D game, it should be fast, and JIT would just make it slower...

Why, why isn't it possible? Why there are no native modern programming languages for these things?

A: 

there is, C. C can be used to write any application , ever !!!

Andrew Keith
So how do you write the first C compiler? ;)
Nick
+9  A: 

C# and .Net are native code. I think you misunderstand the JITter. It's not a VM. A C# program is compiled to fully native code before any of it is executed.

Now, the "needing other components" part is a concern. Give it time, though. You'll be hard pressed to find a windows installation these days without at least .Net 2.0, and even a couple mainstream linux distros include mono out of the box.

Joel Coehoorn
I thought .NET JIT is a Virtual Machine. Sorry.
TTT
Well, the JIT is part of the whole .net virtual machine. The point is that the code is not interpreted, it's compiled to native code on the fly.
Jb Evain
You might want to look at it. http://stackoverflow.com/questions/1564348/is-the-clr-a-virtual-machine
this. __curious_geek
+1  A: 

Compiled .NET programs have been shown to run just as quickly as C. If you want it ultra-lean write it in assembly for your native processor.

Chris Ballance
A: 

You can use the Microsoft NGEN.EXE tool to create a native image of a .NET assembly. See MSDN NGEN documentation. Microsoft already though about what you're getting at here.

Microsoft also makes ILMERGE.EXE tool to merge multiple assembly files into one. This might border on optimization and speed too.

John K
+5  A: 

Don't assume the JIT makes things slower. The JIT can optimize for the exact computer running the application rather than a generic computer like a 386 or Pentium. It can even make better speed/memory trade-off decisions when generating code because it knows exactly what's available. And if JIT still makes things slower, you can NGEN them so that JITting is all done beforehand.

As proof of this, consider that Quake has been ported to the CLR a couple of times, and in my personal tests, the frames per second have been faster when Quake runs on the CLR about half the times I demo it.

Andrew Arnott
A: 

As a side note, Mono has full ahead of time compiling, eliminating the runtime. (I think that's how they get away running on iPhone, which prohibits any JIT.)

MichaelGG
A: 

You want to fast native applications, with API calls and etc, and build 3D games, all on the same platform, without installing anything?

tsilb