in reply to Re^4: Perl and C# - how I use both
in thread Perl and C# - how I use both

I would ask whether those differences are from the language or the framework. I won't dispute that Microsoft produced frameworks that are better than a lot of the frameworks you find in the Java world. But the little bit of experience I have says that Java coded in a sane manner performs very well and has good memory usage properties. Not that I've looked, but I haven't seen anything indicating major difference between the raw performance of .NET and the JVM. And I know the JVM today is much, much better than it used to be.

Speaking personally when I'm forced away from Perl I'd prefer to go to Java than .NET. But that is due to disliking Microsoft, and not wanting to have any factor locking me in to any Microsoft platform.

Replies are listed 'Best First'.
Re^6: Perl and C# - how I use both
by jdrago_999 (Hermit) on Mar 11, 2009 at 02:03 UTC
    Speaking personally when I'm forced away from Perl I'd prefer to go to Java than .NET. But that is due to disliking Microsoft, and not wanting to have any factor locking me in to any Microsoft platform.

    Hey, keep on hackin' in the Free world.

      I was actually interested in an answer to tilly's question. What is it that makes .Net better for you than the JVM with regards to performance / memory use? Because I haven't seen extreme differences in my situations either.

        I was actually interested in an answer to tilly's question. What is it that makes .Net better for you than the JVM with regards to performance / memory use? Because I haven't seen extreme differences in my situations either.

        Here's an experiment.

        1. Configure your Windows machine to turn on IIS, running a simple website (i.e. an email form).
        2. Restart Windows, access the website and take a note of your system resource usage.
        3. Disable IIS.
        4. Create the same setup using JBoss.
        5. Restart Windows, access the Java version of the website and take a note of your system resource usage.

        In all fairness, since this is Windows we're talking about, and there could be special optimizations in Windows to help IIS + .Net work better on Windows than JBoss/Tomcat/BEA Weblogic/Websphere/etc on Windows — go ahead and repeat the Java experiment on Sun Solaris on a Sunfire server instead (with that extra cash hanging out under your sofa cushions).

        I wasn't able to perform the experiment on a Sunfire server with Solaris (no extra dough) but on my laptop (2Ghz dual-core prod with 4Gb RAM) I saw 3x more RAM used by the Java setup than the IIS setup.

        I could start ranting about how I think Java development is mostly a PITA and should be much easier (look at how simple the language is, for God's sake) — but I won't. Strictly looking at resource usage, ASP.Net is clearly the winner when we look at an out-of-the-box configuration. For .Net, this includes JIT-compiling, for Java it does not. Maybe that's why. Maybe it's the stack-based VM vs the heap-based VM. Maybe it's just that the CLR is more modern and builds on the successes and failures of the JVM in a way that the JVM can't.

        I don't know why - I didn't write either VM and certainly won't be writing one anytime soon :-). All I know is that the time it takes me to write something extremely common, say — an email form that allows a file attachment and includes a CAPTCHA — takes about an hour or so with .Net and might take me a couple days with Java. This probably says more about my Java skills than the tools themselves, but the fact that ASP.Net comes with easy file-upload capabilities right out of the box and JSP doesn't (AFAIK) says something.

        IRONY: Discussing ASP.Net and Java on Perlmonks.

        No Java expert, but I think that C# has advantages because of the following point:
        - lightweight objects can be allocated on stack instead of heap and are value types instead of references
        - Java VM needs more tweaking of GC parameters to avoid long GC for bigger programs