views:

95

answers:

5

Recently I have heard the bellow statement. Can someone please elaborate on it?

With client side applications, Java has better performance than .Net. The reason is that .Net environment on the server-side (iis?) is different than its client side. While Java uses the same environment at both ends. Since frameworks performance is optimized mainly on the service side, .Net client side is not as good as .Net server side or Java.

Update: I believe he also mentioned the difference between clients (XP, VISTA) and servers (Windows 2008 server) with respect to .Net

+5  A: 

This makes absolutely no sense.

.NET is not a server side or a client side framework. There are pieces that you use on the server side or on the client side but it's all part of the same beast.

Aside from whether it's correct or not, most (99.9999%) of people who make an unqualified statement like Y performs better than X for some ambiguous and unmeasurable task are, as Carlin would say, embarrassingly full of s***.

Jason Punyon
what about XP vs. Windows 2003 server? Is there any difference between how .Net acts on each?
Yaron Naveh
No there isn't,@Yaron Naveh. It is, as @Jason Punyon said, "all the same beast."
cazlab
+6  A: 

In client operating systems you get a concurrent garbage collector. It is slower in absolute time, but it appears to the user to be faster because they get shorter pauses.

In server operating systems you get a serial garbage collector. It is faster overall, but has to pause applications longer.

This is old information, I don't know if it is still true.


EDIT: Java also has a client and server modes. Unlike .NET this isn't tied to the OS, you instead pass it as a command line parameter.


Edit 2: From MSDN Magizine in Dec. 2000

On a multiprocessor system running the server version of the execution engine (MSCorSvr.dll), the managed heap is split into several sections, one per CPU. When a collection is initiated, the collector has one thread per CPU; all threads collect their own sections simultaneously. The workstation version of the execution engine (MSCorWks.dll) doesn't support this feature.

http://msdn.microsoft.com/en-us/magazine/bb985011.aspx

Again, this is old information and may have changed.

Jonathan Allen
This is essentially correct; what you've left out is that the option is configurable and server mode is disabled by default (even on servers). The switch is in the `machine.config` or `web.config` - `configuration/runtime/gcServer` element.
Aaronaught
Java also exhibits different GC behavior when it thinks it's running in a server vs. client environment.
Eric J.
+1  A: 

The .NET CLR (Common Language Runtime) is the same on the server and on the client side. The .NET CLR works conceptually like the Java VM.

Robert
Citation please.
Jonathan Allen
A: 

There are Client Profiles for .NET 3.5 and later that only provide a subset of the .NET API suitable for client apps, but this is just offered as a convenience to reduce the .NET footprint. Any supported OS can install the full .NET version.

I can only guess that the statement is a result of misunderstanding what a Client Profile is.

Eric J.
A: 

I've never been able to prove to myself that in general terms, Java is faster than .NET. I've run a few of my own benchmarks that indicate quite the opposite, but even then, I'm not willing to make such a blanket statement.

I can say that in pure code execution, .NET executes faster that Java on the same machine, at least the last time I bothered to test about 2 yrs ago. Code written in C# incidentally executes a little faster than VB.NET because C# doesn't have all the type checking that VB.NET does.

The algorithm I used to test was basically a string parser that took a string which was an arithmetic expression, transformed it into reverse polish notation, then determined the answer (stuff taught in many schools). Even doing my best to optimize the code in Java, I could never get it as fast as even the VB.NET code. Differences were around 10% as I recall.

That said, I've not benchmarked GC or other aspects and never have been able to dig up good unbiased benchmarks that actually test either in a real-ish system. Usually you get someone trying to prove why their religion is better and they ignore any other view point. I'm sure there's some aspects of Java where they have better algorithms that will nullify the raw code execution speed.

In short, when people make statements like that, ask them to back it up. If they can't or rely on 'everyone knows it', don't bet the farm on their statements.

Jim Leonardo