Discussions

News: Claim: .NET Performance Still Seriously Lags Java

  1. We all know the limitations of benchmarks, so let's not get into a flame war... but Cameron has been testing the JVM and the CLR with a large ArrayList. Cameron tests multiple versions of .NET (1.0sp2 and 1.1) and JVMs (1.3.x and 1.4.x) with varying memory settings. If this test shows anything, it shows that Java is a match for .NET :)

    Read Cameron's benchmarks, complete with code.

    Read the background thread staring Cam and Rolf

    Again, this doesn't mean that Java is better than .NET! All it shows is that for this code, on Cameron's machine, got the results that he posted. Let's not get carried away :)

    Threaded Messages (164)

  2. This is great,[ Go to top ]

    I dig how it's no longer necessary to mention Cameron's last name... this blog entry is great.
  3. How about....[ Go to top ]

    I enjoyed the little experiment. Now the real test to see if .net is ready for the enterprise is to run similar unbiased tests on true enterprise level systems. Lets try some big hp(hpux), sun(solaris), ibm(aix, linux)servers and see how the results pan out. In the bank I work at, all of our enterprise systems are *nix. I hope this doesn't limit my choice when considering .net... This is a fair assumption isn't it?
  4. Holly wars and TSS popularity?[ Go to top ]

    Could do benchmarks about number of registered/returned users on theserverside.com before and series of PR articals who is better .Net or Java, MS or IBM, offshore or USA?

    I'm leaving...
  5. one moment please..[ Go to top ]

    I hate to remind you all that the tests show that "with the same amount of memory, .NET is faster.

    Cameron just forgot to mention that in his weblog..

    Regards
    Rolf Tollerud
  6. one moment please..[ Go to top ]

    LOL

    Regards
    ROlf Tollerud
  7. Rolf Tollermud[ Go to top ]

    what a doofus!
  8. Hi PPL,

    I know its kinda late... but is the java average method actually returning the average?!
  9. average ...[ Go to top ]

    Doesn't look like it. Hmm ... the old version of the test actually printed the average to verify that both were doing the correct thing (and avoid certain potential optimizations.) That's weird, because the old version of my code (on my HD) that I posted on the old thread (linked to by the new thread) has:

    return silly / 100000;

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  10. I don't know about you guys, but in almost every business application I've ever built in Java or C#, by far the dominating factor in performance was how much network and/or disk I/O I was doing. I didn't realize it until I started using a profiler, but I've found that well over 95% of the time is spent in low level socket operations.

    Could we do a test of whether there is a big difference in I/O between the two frameworks? I would be surprised if there is... conspiracy theories aside, I find it hard to believe Microsoft would cripple their documented Win32 I/O functions... that would be a pretty stupid thing to do, since they'd be crippling themselves in the benchmarks that really DO matter (Windows vs. Unix).
  11. I wonder if the sun server vm even does gc(0) at all so soon.

    How about sprinkling some gc.collect() in some key places ?

    Chameleon
  12. Interesting but not very useful[ Go to top ]

    In almost every business application I've ever built in Java or C#, by far the dominating factor in performance was how much network and/or disk I/O I was doing. I didn't realize it until I started using a profiler, but I've found that well over 95% of the time is spent in low level socket operations.

    I could not agree more. From what I read, I have great respect for Cameron Purdy. Keep up the good work. But this is an interesting, but not very useful test.

    Enterprise applications do mostly IO. I know this may not be a popular opinion on this board, but people interested in the "server side" need more third party benchmarks like the big J2EE-.NET benchmark published here last year, done better. It's very hard to do.
  13. Is it just me, or does anyone else have this vision of Rolf as a big inflatable clown head that you keep hitting over and over with a pinata bat but that just keeps on coming and coming at you? There's just too much hot air in there for you to knock out with the bat.
  14. Is it just me, or does anyone else have this vision of Rolf as a big inflatable clown head that you keep hitting over and over with a pinata bat but that just keeps on coming and coming at you? There's just too much hot air in there for you to knock out with the bat.


    Actually I picture him more as one of those guys on the street corner with holding up a "repent sinner" sign ;-)
  15. Great job![ Go to top ]

    It's nice to know that string concatenation is so much faster in Java. And it's a good job you used that ArrayList otherwise you'd have had to do all those array resizes by hand. What's really cool is that using ArrayList elegantly precludes the use of a struct for the Person type, avoiding the embarassing side-effect of it running, like, five times faster.

    ;-)

    Jim

    Thoughtworks
  16. Great job![ Go to top ]

    Well, you could do a lot in both languages that wouldn't be too terribly object-oriented. More so in C# because it allows the use of structs and some other things that are a little closer to the metal. Hell, you could program the whole thing using pure byte arrays and get things that much faster.

    Quite frankly, I think that a test that uses string concatenation and arraylists (instead of struct arrays) is more useful for a performance analysis than what you suggest because using the OO constructs are both more common and generally better programming practices unless absolute high performance is your goal. If you start programming with structs and non-OO techniques from the start, you're going to have a hell of a time maintaining or extending your code. 99% of the time the advantages of using collection type objects and avoiding structs and other such techniques (from a code readability, extendability, and maintenance viewpoint) far outweigh the performance advantages of not using them. Of course, that's for most business application development. For something like, say, game development, I'd bet the opposite is true.

    People seem to be pretty obsessive about performance when the real money drain on software development comes from the development process, not performance. You'll spend a lot more money on developer man hours with difficult code than you would buying more memory or hardware. And as others have noted, if you're getting to the point where I/O is your performance bottleneck, you're really wasting your time trying to squeeze performance out of your software by changing how strings and collections are handled at the expense of maintainability; you're far past the point of diminishing returns.
  17. Great job![ Go to top ]

    Damn, Jim. I just checked out your weblink and saw that you work for Martin Fowler's company. I guess my most recent post was sort of preaching to the choir, then? ;)
  18. Profiler Result[ Go to top ]

    I ran a profiler on this & played with this sample a little bit.

    It is not the string concatenation or the gc.

    > list.Add(new Person(i, "John " + i));

    This invokes Int32.ToString()

    This function is really slow. So is the alternate in Convert();

    57.7 % of the time is spent in this function.

    Chameleon
  19. Profiler Result[ Go to top ]

    not sure if this msg is posted twice, anyway:
    you gues are all hyped up about Cameron's performance here, headlines all for nothing.

    On the surface it looks like java it a winner here, so with the risk of getting flamed here(as usual this is the place to get flamed), I say the performance test sux.

    the code looks pretty simply, but what Cameron didn't care about was Boxing and Capacity. Ignoring boxing/unboxing, can slow your program down. period. Beauty and the beast in the CLR.

    value types, such as int's requires boxing in order to be treated as objects, so looking at his code

    list.Add(new Person(i, "John " + i));

    take a look at the IL code :

    IL_0011: ldstr "John "
    IL_0016: ldloc.1
    IL_0017: box [mscorlib]System.Int32 <-- boxing takes place here
    IL_001c: call string [mscorlib]System.String::Concat(object, <-- object) <--
    IL_0021: newobj instance void people.Person::.ctor(int32,
                                                            string)
    IL_0026: callvirt instance int32 [mscorlib]System.Collections.ArrayList::Add(object)

    no boxing occurs here:

    list.Add(new Person(i, "John " + i.ToString()));

    IL code:

    IL_001c: ldstr "John "
    IL_0021: ldloca.s V_1
    IL_0023: call instance string [mscorlib]System.Int32::ToString()
    IL_0028: call string [mscorlib]System.String::Concat(string,
                                                                string)
    IL_002d: newobj instance void people.Person::.ctor(int32,
                                                            string)
    IL_0032: callvirt instance int32 [mscorlib]System.Collections.ArrayList::Add(object)

    also notice the String::Concat here.

    another optimization is calling the ArrayList.Capacity, this will reallocated the internal array, thereby preventing this from happening during the loop.

    also in his 'test' method which gets called in a loop:

    DateTime finish = DateTime.Now;
    Console.WriteLine("Total time for iteration " + iIter + ": " + (finish - start));

    IL code:
    IL_004d: box [mscorlib]System.TimeSpan <--- boxing.
    IL_0052: stelem.ref
    IL_0053: ldloc.3
    IL_0054: call string [mscorlib]System.String::Concat(object[]) <--
    IL_0059: call void [mscorlib]System.Console::WriteLine(string)
    IL_005e: ret
    } // end of method ManyPeople::test
    actually boxing takes place with iIter value type also. IL code not shown, I assume you believe me.

    a simple rewrite and no boxing takes place:

    DateTime finish = DateTime.Now;
    TimeSpan dt = finish - start;
    Console.WriteLine("Total time for iteration " + iIter.ToString() + ": " + dt.ToString());

    so here are my results, funny it shows a different picture, yeah go figure

    ladies first:
    C:perf\javaperf\classes\java -server -Xms24m -Xmx24m ManyPeople
    Total time for iteration 0: 4467
    Total time for iteration 1: 4316
    Total time for iteration 2: 4306
    Total time for iteration 3: 4326
    Total time for iteration 4: 4307
    Total time for iteration 5: 4326
    Total time for iteration 6: 4316

    and now for the C# version with no boxing and use of Capacity.

    C:perf\people\people\bin\Release\people
    Total time for iteration 0: 00:00:03.1945936
    Total time for iteration 1: 00:00:02.9542480
    Total time for iteration 2: 00:00:03.0844352
    Total time for iteration 3: 00:00:03.1244928
    Total time for iteration 4: 00:00:03.1545360
    Total time for iteration 5: 00:00:03.0443776
    Total time for iteration 6: 00:00:02.7840032

    hmm

    actually I tried to ngen.exe my code, it showed this:
    C:perf\people\people\bin\Release>people
    Total time for iteration 0: 00:00:03.1044640
    Total time for iteration 1: 00:00:02.9141904
    Total time for iteration 2: 00:00:03.1845792
    Total time for iteration 3: 00:00:03.4048960
    Total time for iteration 4: 00:00:03.1244928
    Total time for iteration 5: 00:00:03.3748528
    Total time for iteration 6: 00:00:03.1244928

    not spectacular faster, as a matter of fact, it's slower at some points. The CLR makes some pretty smart choices when loading and jit'ing the code.

    now with boxing and no Capacity, it looks like this

    C:perf\people\people\bin\Release\people
    Total time for iteration 0: 00:00:04.3662784
    Total time for iteration 1: 00:00:04.1259328
    Total time for iteration 2: 00:00:04.6166384
    Total time for iteration 3: 00:00:04.3863072
    Total time for iteration 4: 00:00:04.1059040
    Total time for iteration 5: 00:00:04.1459616
    Total time for iteration 6: 00:00:04.0958896

    you see the performance loss here.

    how many times have TSS published useless performance test so far ? way to many times imo.

    funny thing happened I accidentally tried to compile the java code with vs.net until I saw it was the java code I was trying to compile...yeah the code does look awful lot alike, let's just sit down in a circle and smoke.

    test was made on a 2,4 ghz notebook, running XP pro. 512 ram, using vs.net 2003 ver 1.1 and jdk 1.4.1_02.

    Cheers Allan
  20. Profiler Result[ Go to top ]

    justice for all, the hotspot does a better job from time to time.

    C:\perf\javaperf\classes>java -server -Xms128m -Xmx128m ManyPeople
    Total time for iteration 0: 3616
    Total time for iteration 1: 3364
    Total time for iteration 2: 3445
    Total time for iteration 3: 3405
    Total time for iteration 4: 3445
    Total time for iteration 5: 3445
    Total time for iteration 6: 3345

    but still
    cheers, Allan

    "Just because your voice reaches halfway around the world doesn't mean you
    are wiser than when it reached only to the end of the bar."
       --Edward R. Murrow
  21. Re: Profiler Result[ Go to top ]

    a n: >>
    the code looks pretty simply, but what Cameron didn't care about was Boxing and Capacity. Ignoring boxing/unboxing, can slow your program down. period. Beauty and the beast in the CLR.
    <
    I thought I saw it being mentioned that the test was not written by Cameron at all. It was some .NET guy showing how much faster .NET is. But as it was shown, it looks like the .NET guy didn't know everything about performance.
  22. Re: Profiler Result[ Go to top ]

    oh shoot,
    probably a VB guy stumbling over .net ;-)

    Cheers, Allan
  23. A Voice of Sanity[ Go to top ]

    Thanks Drew, for bringing this thread back to earth.

    IMHO, the key attributes of modern application development are (in no particular order):

    Speed of development
    Robustness
    Maintainability

    Performance is way down the list. But this thread isn't about the real world, it's about refuting Microsoft FUD!

    /david
  24. Great job![ Go to top ]

    Jim: It's nice to know that string concatenation is so much faster in Java.

    That's an interesting opening line.

    Jim: And it's a good job you used that ArrayList otherwise you'd have had to do all those array resizes by hand. What's really cool is that using ArrayList elegantly precludes the use of a struct for the Person type, avoiding the embarassing side-effect of it running, like, five times faster.

    OK, you're going to make me go do my homework. IIRC, I didn't write the benchmark test; it was some .NET zealot named Edgar Sanchez. Don't pick on me; I'm just the guy to show the .NET zealot that the ".NET beats Java" example he gave was bogus and Java was beating .NET in his own test. If he can't code in C#, you need to go bother him about it. He and tRolf certainly did a good job of making .NET look a lot worse than it actually is ;-).

    I don't personally care if Java is faster than .NET or .NET is faster than Java. I wish people would think a little bit about how inconsequential a little performance difference is. Java is 10-15% faster in my tests. So what?!? That doesn't make .NET programmers have any smaller you-know-whats. And .NET is getting faster ... so what?!? That doesn't make mine shrink either. Software that works and works well is a lot more important than an array of structs vs. an array list of objects. Or 2x as fast here or 15% faster there.

    I only participated in this nonsense because a falsehood was posted disguised as an independent study. Just like when the TMC Petstore study first came out and had no reference to Microsoft paying for it. Or when this Doculabs report came out and it doesn't point out who paid for it! (Although it says it was paid for! And only one vendor agreed to particpate: Microsoft!) Or when "researchers" at universities are just paid marketers for Microsoft, and hide that information. What a load of bollocks.

    Before this, I didn't really care much one way or another. But with all this sneaking around garbage that Microsoft is doing, not to mention this tRolf dork, I think I am going to change my official stance to disliking .NET. As long as I can still use Windows 2000 and Office XP, that is. ;-)

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  25. Cameron[ Go to top ]

    I read through all u'r posts and discussion with tRolf and seems like
    u'r a very patient man.

    Did it ever occur to u that tRolf could be one of the M$ nominated
    lurkers on these boards to spread FUD.

    More info
    >> http://news.com.com/2100-1016_3-1001845.html?tag=rn
  26. You don't say...[ Go to top ]

    Did it ever occur to u that tRolf could be one of the M$ nominated

    > lurkers on these boards to spread FUD.

    Occur to me? It's the only plausible explanation.

    After all, surely nobody could be so tragic as to hang around day after day in a community where they are so universally despised, unless they were getting paid for it.
  27. not so bad[ Go to top ]

    Did it ever occur to u that tRolf could be one of the M$ nominated

    > > lurkers on these boards to spread FUD.
    >
    > Occur to me? It's the only plausible explanation.
    >
    > After all, surely nobody could be so tragic as to hang around day after day in a community where they are so universally despised, unless they were getting paid for it.

    i think, it's not a bad idea to have an "advocatus diaboli" on the board. He asks questions some of us hesitates to ask. I think this is important.

    And, it's fun, too :-)) For example have you read "First Last"'s reply to Rolf about CACHING? Heh he, that cracked me up, I almost fell from my chair :-))

    cheers
    joe
  28. j2ee server with ejb 18x faster![ Go to top ]

    "Heh he, that cracked me up, I almost fell from my chair :-)"

    Not so much as I laughed!

    "some folk are wise, and some are otherwise"
  29. You keep beating and beating at it with the pinata bat but it just keeps bouncing back...
  30. Pinata[ Go to top ]

    Here's another bat: (this one's quite a whack)

    http://www.businessweek.com/2001/01_06/b3718158.htm

    What the h**l am I doing here on saturday evening? And there's even Godfather (1st.) on tv...
  31. Whats wrong with you folks?

    The background thread was "NET webservices outperforms J2EE webservices in new test" (yet another .NET outperform Java benchmarks).

    The discussion started because Cameron made a false claim in his weblog at
    http://www.freeroller.net/page/cpurdy/20021118. "Java whalloped .NET by over 30%".

    (Why did not Dion started a "NET Performance Still Seriously Lags Java" thread then?, because the new weblog shows nothing new).

    I then showed that Cameron had cheated (as usual) by allocating 5 (well 6 is nearer to the mark) times as much memory to that Java app.

    So after the long discussion, he presents another test, which is the same as the first, only he has started with the lowest memory at about 1.6 times of the .NET application. (and with this memory .NET 1.0 is a little faster 1.1 a little slower).

    But he deliberately leaves out the test that use the same amount of memory as the .NET app! (and leaves Java far behind in performance).

    After Cameron in loses the discussion (in fact I felt so sorry for him as I feeled I had to comfort him a little..)Dion starts a ""NET Performance Still Seriously Lags Java" thread! And people are full of glee!

    And I who though the discussion after "the Java Petshop benchmarks was the most stupid I ever seen!

    Regards
    Rolf Tollerud
  32. Great job![ Go to top ]

    Cameron: OK, you're going to make me go do my homework. IIRC, I didn't write the benchmark test

    I know, I know - I was just stirring it up a little :-) although given all your protestations of "so what?!? so what?!?", I have to wonder why you bother getting involved in the debate at all?

    Come on Arsenal!

    Jim

    Thoughtworks
  33. Great job![ Go to top ]

    Jim: ... although given all your protestations of "so what?!? so what?!?", I have to wonder why you bother getting involved in the debate at all?

    It's some inane American concept of fair play. Seeing falsehoods disguised as truth for a price and published in someone else's name is very disturbing. Someone needs to point it out. The rest of the thread is just the unfortunate cost of pointing out the truth. I never set out to show that .NET was slower, and it wouldn't surprise me that with some code optimizations to the test, .NET could even be faster. Big whoopty doo. That's not why I got involved. Go back a couple of months in my blog, and you'll see that I really don't care whether .NET is faster or slower. But I do care when I see companies playing more loose with ethics than Enron ever dared. We have a right to demand better; incorporation is not a shield from moral responsibility. I refuse to accept that one must lie and cheat to win.

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  34. I refuse to accept that one must lie and cheat to win

    It must be the most outrageous statement in all history! From one that in two threads done just that, - coming from the body so to speak, with the bloody knife still in his hands..

    My god..

    Regards
    Rolf Tollerud
  35. <Some technical subject>
    X:<Some technical argument>
    TROLF: Yeah, but weather in Seattle is warmer, so MS produces better software!!
    X:<More technical arguments...>
    TROLF: Yeah right!! But Eminen has a new hit now!!!
    X:Come on!!! We are talking about technical stuff!!
    TROLF: Yeah, I am talking about real life applications!
    X: Good!! Could you tell me what your experience is?
    TROLF: ahhhh... have you read EL QUIJOTE??
    X:<More technical stuff...>
    TROLF: You know? Madonna really sings well!!
    .
    .
    .
    I guess we DO need feedback, but ROLLF is not providing it and this forum is becoming anything else but a technical forum. Can we enforce any kind of control as MS has for its GoDotNet forums????

    Just my 0.00000002 cents.

    Peace! (I hope Cameron does not mind me using his closing line)
  36. // guess we DO need feedback, but ROLLF is not providing it

    The best way to handle these loonies is not to reply. Certain newsgroups have tried that approach (a concensus of the core of participants) with great success.
  37. simplicity itself..[ Go to top ]

    The best way to handle these loonies is not to reply. Certain newsgroups have tried that approach (a concensus of the core of participants) with great success.

    If you want me to stop, all that is necessary is a simple email from Floyd.

    Regards
    Rolf Tollerud
  38. I guess not !!![ Go to top ]

    Roberto :
    I disagree. Actually, annoying as tRolf is (i'm almost sure he works for M$), we shouldn't ban him or something. When I revise the threads he "crashes" in, I find out he gets the best out of us (Hadn't it not been for tRolf i wouldn't have got to know how much technical, and very patient as it matters,Cameron is). Now, my eyes are almost "trained", i go through the thread, skip tRolf's messages and read Cameron's ---> new info acquired,mission accomplished, have a nice day.
    I confess i thought of the same idea (banning him), but what the heck, i think almost everybody agrees upon the way the conversation between him and us goes (i'm ready to take a vote for that for TSS users, and non-TSS users also as some friends of mine periodically ask me "any news about the Rolf?") :
    <Cameron>

    1) Rolf makes stupid claim
    2) Everyone shows claim to be stupid
    3) Even Rolf posts results showing claim to be stupid
    4) Rolf tries to change subject before anyone notices

    </Cameron>

    mmm .. what do u think?

    Peace be with u
    Abdel Hamid El Refaiy
  39. Perception is an amazing thing[ Go to top ]

    There is not such thing as the perfect solution, Java is really good at some things and .Net is really good at some things and that the .Net vs. Java and if performance was an issue no one would ever have used VB or RDBMS or GUIs, I know this because I am a developer.

    I also know that Management doesn't care what the developers know, Management does read marketing and they do read research and Microsoft knows how to play that game all to well. Microsoft has sucessfully created that Perception among Managers that .Net is faster than Java.

    This is not a Technical Issue, This is a perception Issue that Microsoft has created among managers with the sole purpose to get into enterprises and suck their Wallets dry. Microsoft will never play fair, they will always get away with corporate terrorism. They will do everything and anything it takes to make sure they dominate IT at every level. To do that they need to eliminate strong rivals, currently the two most prominent enterprise targets in the crosshairs are Java and Linux and the only weapon Microsoft has is perception.

    While the .Net/Microsoft perception exists among managers, who cares if we know that Java really is faster or not, because that won't change managers perceptions one little iota.
  40. Perception is an amazing thing[ Go to top ]

    "There is not such thing as the perfect solution, Java is really good at some things and .Net is really good at some things.."

    That is correct and I would be the first to admit that the micro benchmarks have no real importance.

    But if the Java camp could learn to use solutions as the extremely fast and stable Resin and let the database take the load (with its own internal cache), instead of overcomplicated "J2EE App servers" with Entity beans and large O/R products + commercial cache products..

    It is this penchant for "overengineering" and "love of computer science" that is the real catastrophe for Java and the reason why there are so few "J2EE Success stories" and for the 80% project failure rate.

    That is the truth.

    Regards
    Rolf Tollerud
  41. Perception is an amazing thing[ Go to top ]

    It is this penchant for "overengineering" and "love of computer science" that >is the real catastrophe for Java and the reason why there are so few "J2EE

    >Success stories" and for the 80% project failure rate.

    80%? Oh ya .Net has a 80.43% failure rate, you loose! What's my source? The same as your source; I got it out of my ass.

    Seriously, where do you get your material Rolf? Your giving me more laughs with your posts than the stand up comics on the comedy channel.
  42. Overengineering ala Rolf[ Go to top ]

    But if the Java camp could learn to use solutions as the extremely fast and

    > stable Resin and let the database take the load (with its own internal cache),
    > instead of overcomplicated "J2EE App servers" with Entity beans and large O/R
    > products + commercial cache products..
    >
    > It is this penchant for "overengineering" and "love of computer science" that is the real catastrophe for Java and the reason why there are so few "J2EE Success stories" and for the 80% project failure rate.
    >
    > That is the truth.
    >
    > Regards
    > Rolf Tollerud

    Yes Rolf. Cache is a bad thing. We all know this and that's why all the Intel and AMD and XXX processors don't have L1 and L2 level caches. Oh the database? Surely it's bright enough to be able to cache and predict my queries that read data from 3...8 different tables to construct a business object (a Transferobject/Valueobject whatever the name of the pattern is)

    Load. Read from the database. Typical application like this website spends 99% of it's time serving these pages to 'clients' - it really makes sense to read them directly from the database. Every time.

    Since I almost bought this Entity bean FUD some time ago I ran a comparison test. Session facade and DAO pattern made it really easy to bypass the entity bean level. Guess what - the entity bean solution was 30% slower on a first time (it has to construct the entity beans which hold my valueobjects and I had also marked the ejbLoad method as transaction in the deployment descriptor) The bypassing session method talked directly to DAO layer and ran without transaction context. The next time I requested those same objects from the server the entity bean solution was 18 x faster. 18 times faster.

    Cache sucks. and Rolf knows this. But I think I still stick with the entity bean solution. After all there's almost zero code in those beans. All they do is cache my objects and read/update/delete them from/in the database via DAO objects.

    Overengineering? Perhaps - what am I to argue against such competent software architect. But it's flexible. Our software runs on windows and linux (both the server and client) It works on three different databases (MySQL, Oracle and MS SQL) without a single line of difference in JDBC code. The level 3 JDBC usage completely separates you from the hassles of primary key issues (which are different on every database)

    For the MS SQL we have to use commercial driver because MS's own drivers suck so badly in performance and stability wise. For oracle this is the same thing, not because of performance or stability issues but because they don't have a level 3 JDBC driver. MySQL works like a charm. The quality of their JDBC driver is outstanding. Even the earliest beta versions worked flawlessly. From these three the MySQL is also the fastest.

    But windows XP is really nice platform to run the client app. the Swing client runs smoothly on my 1.6GHz compaq laptop. The only problem is the ATI driver which crashes the swing client if run in directdraw mode.

    The clients run windows on their desktop, but they have no problems accepting linux servers. And since Debian is *so easy* to maintain it makes the administrators job almost boring.
  43. only perception?[ Go to top ]

    Doculabs report:

    Microsoft .NET provided the best performance among the products evaluated in all tests

    Against a backend Oracle 9i database, .NET on Windows Server 2003 (8 CPU) achieved 110 percent better throughput than the leading J2EE product against the same Oracle 9i

    Overall, .NET provided significantly better performance results versus the J2EE products acting as both a Web Service client and a Web Service

    NET 1.1 framework running on Windows 2003 with SQL Server 2000 database achieved the best throughput results for direct Web Service invocation test on an 8 CPU host, at 1488.53 transactions per second (1072.90 transactions per second on a 4 CPU host)..

    The fastest J2EE application server performance was achieved by JBoss running on Red Hat Linux 8.0 at 513.33 transactions per second (354.25 transactions per second on a 4 CPU host) and followed by Application Server Y at 411.87 transactions per second (312.70 transactions per second on a 4 CPU host) and Application Server X at 288.26 transactions per second (213.37 transactions per second on a 4 CPU.

    The Ziff Davis Labs benchmark:

    The Visual C++ application maxed out at 3,441 pages per second on Windows NT with four Compaq four-CPU systems. The same application running on Windows 2000 with four Compaq eight-CPU systems showed maximum throughput of 8,894 pages per second

    Yes gentlemen, you heard right: 8,894 pages per second!

    Regards
    Rolf Tollerud
  44. only perception?[ Go to top ]

    The Visual C++ application maxed out at 3,441 pages per second on Windows NT with four Compaq four-CPU systems. The same application running on Windows 2000 with four Compaq eight-CPU systems showed maximum throughput of 8,894 pages per second


    I think this nicely highlights the ridiculousness of all this concern over performance. You want performance, program in 'C', or better yet assembly. You want to get the job done sometime this century and you want it to be robust, then use Java or C# (or even VB, PHP, Python, Perl, Ruby -- depending on your requirements and personal/company prefferences).

    For Chrisake people, Google is running on Python. Servers are cheap relatively to development. Make your solution scalable and use whatever friggen language/technology you like. Sheesh.
  45. performance is everything[ Go to top ]

    Anick,

    With the type of applications we work on, we sometimes have problems with the performance with one (1) user! So perhaps you understand my preoccupation.

    It is the same as real estate: location, location,location

    Regards
    Rolf Tollerud
  46. performance is everything[ Go to top ]

    Anick,

    >
    > With the type of applications we work on, we sometimes have problems with the performance with one (1) user! So perhaps you understand my preoccupation.
    >
    > Regards
    > Rolf Tollerud

    Would the applications in question be:
    Windows 95
    Windows 98
    Windows ME
    Windows NT
    Windows 2000
    Windows XP

    ??
  47. Anick,

    <sarcasm>The application is DOS based!</sarcasm>

    Regards
    Rolf Tollerud
  48. Good choice[ Go to top ]

    Anick,

    >
    > <sarcasm>The application is DOS based!</sarcasm>
    >
    > Regards
    > Rolf Tollerud

    I knew you'd pick the right platform. After all, it is the most stable of all MS products! ;-)
  49. performance is everything[ Go to top ]

    With the type of applications we work on, we sometimes have problems with the performance with one (1) user! So perhaps you understand my preoccupation.


    Than you should probably write it in C/C++ or assembly. Sometimes performance on a single machine does matter. I'm not expecting to see a first person shooter game in Java or C# anytime soon ;-) I used to do real-time DSP and it mattered and I used C as was appropriate. Today I program web applications and I have not seen performance on a single computer come up as a problem yet, but this is just my anecdotal experience. I've never seen the CPU at 100% yet and almost everything seems to IO bound. In these cases performance has everything to do with smart caching, batched queries, etc and almost nothing to do with the language. I would suspect that this applies to 90% of projects out there. For those 10% left over, probably 1/2 of them can solve their problems with simple profiling and optimizations. For the 5% left over they may have to code slow pieces in C/C++. Moving from Java to C# and vice versa is unlikely to make a big enough difference to solve their problems (most people that have a performance problem need an order of magnitude improvement or more, not 10-15% improvement or even 100% improvement)
  50. Action game in Java.[ Go to top ]

    With the type of applications we work on, we sometimes have problems with the performance with one (1) user! So perhaps you understand my preoccupation.

    >
    > Than you should probably write it in C/C++ or assembly. Sometimes performance on a single machine does matter. I'm not expecting to see a first person shooter game in Java or C# anytime soon ;-)
    There IS at least one action game written in Java (though not in pure Java) :) http://www.gamezone.com/gzreviews/p12713.htm

    So when will we see an action game written in C#?
  51. Action game in Java.[ Go to top ]

    There IS at least one action game written in Java (though not in pure Java) :) http://www.gamezone.com/gzreviews/p12713.htm


    That is interesting if true. How can you tell that this game is written in Java from this link? I saw no mention of Java.
  52. Action game in Java.[ Go to top ]

    Sure, this is just one of the mega-mega wannebe java apps.

    http://www.avsim.com/pages/0102/il-2/il-2.html
    'Next urban legend says, that IL-2 is coded in Java. Again, this assumption is based on rumors only, and has no substance. Java is used in IL-2, but just in small part. C++ is mostly used in coding this baby.'

    But I mean, people on the net need just the message, not the facts. I mean, if I would only use the net to inform myself, check the newsgroups and ask the 'pros' there, I would probably come to conclusion that linux is right now killing win32 in every single possible way. Which of couse is not happening(unfortunately).
  53. Action game in Java.[ Go to top ]

    Sure, this is just one of the mega-mega wannebe java apps.

    >
    > http://www.avsim.com/pages/0102/il-2/il-2.html
    > 'Next urban legend says, that IL-2 is coded in Java. Again, this assumption is based on rumors only, and has no substance. Java is used in IL-2, but just in small part. C++ is mostly used in coding this baby.'
    >
    > But I mean, people on the net need just the message, not the facts. I mean, if I would only use the net to inform myself, check the newsgroups and ask the 'pros' there, I would probably come to conclusion that linux is right now killing win32 in every single possible way. Which of couse is not happening(unfortunately).

    I have IL-2 on my machine. I did some reverse engineering today. It seems that all game's "business logic" is implemented in Java. C++ is used mostly for rendering and user interaction (no wonder because JNI is such a slow thing). And speaking as a former game developer, rendering is usually only 10% of the whole game.
  54. Action game in Java.[ Go to top ]

    I have IL-2 on my machine. I did some reverse engineering today. It seems >that all game's "business logic" is implemented in Java. C++ is used mostly >for rendering and user interaction (no wonder because JNI is such a slow >thing). And speaking as a former game developer, rendering is usually only >10% of the whole game.


    I am really interested how you could _reverse engineer_ the software to find out the logic is done in java.

    java was done for the gui/game menu and editors, as far as my digging into the
    forums 'revealed'.

    of course the publisher/programmer knew that the news of IL and java would stir up attention, so they made no clear statement (nice advertising).

    bottom line: the game industry is not made out of idiots and pro-microsoft-vb-hackers. They simply do *not* use java.
  55. Action game in Java.[ Go to top ]

    I have IL-2 on my machine. I did some reverse engineering today. It seems >that all game's "business logic" is implemented in Java. C++ is used mostly >for rendering and user interaction (no wonder because JNI is such a slow >thing). And speaking as a former game developer, rendering is usually only >10% of the whole game.

    >
    > I am really interested how you could _reverse engineer_ the software to find out the logic is done in java.

    1. There is an active JVM during gameplay.
    2. Class names. Something like PitchYawController doesn't seem to be GUI.
    3. There are two active threads that use 90% of CPU.
    4. Debugger shows there are lots of calls from one of this threads to
    DLLs outside JVM. It is clearly the rendering thread.
    5. When I schedule the rendering thread to a partly loaded processor
    on a 2-processor server FPS reduce (other threads are working on anp).
    6. When I schedule another thread to a partly loaded processor sound becames
    clanky and the game becomes unresponsible.

    > java was done for the gui/game menu and editors, as far as my digging into the
    > forums 'revealed'.
    If you read in Russian I can give you some posts from newsgroups with quite opposite opinions :)

    PS: Don't worry I'm just adding some oil to this flame-war.
  56. Action game in Java.[ Go to top ]

    forums 'revealed'.

    > If you read in Russian I can give you some posts from newsgroups with quite opposite opinions :)
    > PS: Don't worry I'm just adding some oil to this flame-war.

    Agreed. It requires engineering skill to make this thing work (JNI wrapped stuff). Swig can do this for java - I use if /w python/C++.

    Let's see if this is /was a trend - software developers will always chosse the best tech. for games.

    Could be there is a log of java involved there..
  57. Action game in Java.[ Go to top ]

    Try some of these links:-

    These are interesting little demos I've kept bookmarked over the years, I used to use them when teaching Java for C and C++ programmers (for Learning Tree). I'd be interested if anyone has any more.

    Mintrix - single and multiplayer games
    They also have games for mobile phones, try that in .NOT

    DS Effects - Increadable applets
    The author is a programming God, just look at what he can do with AWT in a applet. Try doing this portably using .NOT technology.

    Ozos Web - a 3D demo.
    I don't know if anything ever came of this but it's been around for a number of years, quite impressive for a portable applet.

    -John-
  58. performance is everything[ Go to top ]

    Out of curiosity, what kinds of applications do you work on?
    What is the domain, or problem set, such that your applications cannot perform for even 1 user?
  59. performance is everything[ Go to top ]

    Calvin,

    It is just that when you work with "Rich Clients" you have to use all your knowledge, tricks and experience to keep the performance on an acceptable level.

    Move some functionality from the server to the client, for example XSLT transformations. Use HTTPRequest to update special parts of screen, - it is just too slow when everything is done on the server..

    We are porting "real life windows applications" (Delphi, VB and C++) to .NET/C#.

    Regards
    Rolf Tollerud
  60. performance is everything[ Go to top ]

    "We are porting "real life windows applications" (Delphi, VB and C++) to .NET/C#."

    >> Would you mind to tell us what are those "real life windows applications" you are porting to .NET? I know I have asked the same question one million times but you haven't answered yet. If you can provide a link to visit would be really nice of you.

    "It is just that when you work with "Rich Clients" you have to use all your knowledge, tricks and experience to keep the performance on an acceptable level. ... it is just too slow when everything is done on the server.."

    >> Buddy, you are discovering the gun powder in 2003. There is something called distributed computing, distribute your processing, use multithread or multitasking where applicable, use the old concepts of fat/ligth server/client where applicable, etc etc etc...
  61. Roberto,

    Can you please stop answering post that was not directed at you? I am not talking to you. Did not your mama teach you to be courteous and well-mannered?

    Come again when you have learned to be polite!

    Regards
    Rolf Tollerud
  62. Roberto,

    >
    > Can you please stop answering post that was not directed at you? I am not talking to you. Did not your mama teach you to be courteous and well-mannered?
    >
    > Come again when you have learned to be polite!
    >
    > Regards
    > Rolf Tollerud

    ... and Rolf takes the tangent again.
  63. Roberto,

    > >
    > > Can you please stop answering post that was not directed at you? I am not talking to you. Did not your mama teach you to be courteous and well-mannered?
    > >
    > > Come again when you have learned to be polite!
    > >
    > > Regards
    > > Rolf Tollerud
    >
    > ... and Rolf takes the tangent again.

    Yes, thats one thing about Rolf that never stops amazing me. I would be ashamed when someone confronts me having my facts wrong or spreading FUD. Rolf isnt, he just picks some unrelated detail and spawns a new thread from there. Quite amazing behaviour from an - presumably - educated person.
  64. "Did not your mama teach you to be courteous and well-mannered?"
    >>Please, Just answer my question.
    >>Didn't your mama teach you to not involve someone else's parents when arguing ?? I think she did but you didn't learn. :-)
  65. performance is everything[ Go to top ]

    "We are porting "real life windows applications" (Delphi, VB and C++) to .NET/C#."

    I would have been a bit dissapointed but not to suprised if those would have been "make believe windows applications".. :)

    Impolite to get involved in the discussion? I thought discussion-forums were for.. erm, discussing?
    However, it would be interesting to get some well thoughtthru arguments based on transparent and provable data (ie: NOT a MS paid-for benchmark, and no: I dont believe in those from Sun/Oracle/IBM either) instead of the religous rantings of ".Net rules, java sucks", it kind of sounds like an old record with bad lyrics..

    And to add a little background: I am NOT religous in any direction, I prefer to use whatever technology suits the circumstances instead of trying to shoe-horn the circumstances into the technology. I prefer working with Java/J2EE, but I would never dream of making a windows-application in Java (C++ please..), well, I did once actually, a Swing-application that sucked the living-daylights out of any machine it ever was run on (Hey, I was young, inexperienced, and did it in Swing).
  66. performance is everything[ Go to top ]

    Since Rolf seems to work for Telia and from an old email address of his I'd guess he's living in Sweden (there are also no Tollerud registered to vote in the UK).

    My guess is that he's writing some internal applications for Telia, perhaps for client billing etc. It's obviously not at the sharp end because he'd be writing it in Java :-). It can't be an external application because, again he'd need Java technology to handle the multi user, multi threading and scalability :-).

    Well, I wish him well in his tiny little .NET world, he reminds me of the Japanese soldiers they found on a Pacific island who thought the war was still on in 1950 something.

    In the mean while we'll just get on with "real life [] applications", not just "[windows]" but also Mac, Solaris, AIX, HP-UK, Linux, MS, Symbian, Palm-OS, ...

    -John-
  67. performance is everything[ Go to top ]

    Since Rolf seems to work for Telia and from an old email address of his I'd

    > guess he's living in Sweden

    Yes, but lets be quite about that. I am Swedish and I am certainly not prepared to take responsibility for Rolfs actions...
  68. performance is everything[ Go to top ]

    I doubt that Rolf works for Telia, Telia happens to be swedens largest ISP as well, so I would guess that e-mail is from his privat dial-up or DSL connection..
    And to top that of: I think Telia are quite heavy on the java, seem to remember a job-ad for them a year or so back when they demanded java-skills..
  69. J2EE / .NOT[ Go to top ]

    My 2p's worth...

    All this C#/Java and .NET/J2EE is rather tiring, I recently spent months in a major bank on the WebSphere/WebLogic, Tibco RV/MQ Series issues, it's always the same; Give people the choice and they argue about it.

    It's nice and simple, if you want speed then write it in assembler, there's very little reason to write new projects in C or C++ now and VB is plain madness unless you're writing client side prototypes even then it's very dodgy. There will always be legacy uses for VB, C, C++, Objective C, Eiffel, Occam, COBOL, Algol, Fortran, RPG et al but for new projects there are only two decent choices, Java and C#.

    C#, did I say that? Now comes the platform choice; If you're a MS shop then you're probably going to go for .NET, it's the obvious choice for the un-initiated. The problem comes when you want to connect to the rest of the world, then you're going to have to move to J2EE or spend months messing around with BizTalk, the first is going to be a challenge but the latter is close to impossible! If you're J2EE already then there's no argument at all to move to anything else. So if you're living in a small un-connected MS world then stay there or go .NET there otherwise J2EE is the only solution for the rest of the world.

    Windows is a good desktop client (I never thought I'd say that!), I'd love to move off 2000 and XP to RedHat or SuSE but I just can't get the support yet for my new gadgets, 802.11g, DVD writers, high-res screen, scanners, digital cameras and printers etc and before anyone replies with Linux links I'm talking new, I'm aware of the zillions of drivers for scanners, cameras and printers etc. mine are just a little too new. Skip back a few years and Windows used to be the same, buy the latest graphics card or token-ring and you spent ages trying to find drivers on CompuServe. I love Linux, I run it on all my servers. To move into the desktop/laptop market though is going to be a hard ride. I really hope we see it taking a serious stake out of the desktop market but I think the server side is already won.

    The problem with Windows though is that it’s CRAP for servers and anything needing serious connectivity, up time, support, scalability, remote access etc. etc. It's missed the boat and will never catch up now.

    As for Web Services well that's really just .NET/J2EE connectivity marketing. Let's be honest, if Java and J2EE didn't exist do you think Micro$oft would really want to use Web Services? No, they wouldn't need it; they'd use proprietary MS protocols and clients like COM, COM+ and DCOM. It is the Java platform that has forced them to look for a common "language". It's obviously not going to be CORBA, not a great idea anyway but MS and kitchen fridges are about the only platforms not to support it. A better choice would be JMS but again of the 40 odd JMS vendors MS isn't one of them. Jini would be even better but now we’re dreaming. So, we've got Web Services, a new way of doing what we've been doing for decades but finally something MS supports.

    Perhaps that was 4p’s worth, time to write some code…

    -John-
  70. C++[ Go to top ]

    John - don't be silly - there is good reason to use C++. For example please show us your assembly version for this test ;-) ... ya that's right, I don't have that kind of time to waste either. On the other hand converting the example to C++ is easy and there is a significant benefit in performance.

    Here are results for C++ (my interpretation, see code below):

    C++ version on my machine:
    Total time for iteration 0: 2500
    Total time for iteration 1: 2510
    Total time for iteration 2: 2510
    Total time for iteration 3: 2510
    Total time for iteration 4: 2510
    Maximum memory usage: 4M

    Java version on my machine:
    Total time for iteration 0: 8695
    Total time for iteration 1: 8319
    Total time for iteration 2: 8366
    Total time for iteration 3: 8534
    Total time for iteration 4: 8304
    Maximum memory usage: 26M

    Sorry my machine is Linux so I can't try out .Net version.

    Here is my conversion of test to C++:

    #include <string>
    #include <vector>
    #include <iostream>
    #include <sys/times.h>

    using namespace std;

    class Person
    {
    private:
      int id;
      string name;
      
    public:
      Person(int anId, string aName)
      {
        id = anId;
        this->name = aName;
      }
      
      int getId()
      {
        return id;
      }
    };

    long average()
    {
      vector<Person *> list;
      
      for (int i = 0; i < 100000; ++i)
        list.push_back(new Person(i, "John " + i));
      
      long silly = 0;
      for (int i = 0; i < 100000; ++i)
        silly += list[i]->getId();

      for(int i=0;i<100000;++i)
        delete list[i];

      return silly/100000;
    }

    void test(int iIter)
    {
      tms start, end;
      times(&start);
      for (int i = 0; i < 20; i++)
        average();
      times(&end);
      cout<}

    int main(int argc, void **argv)
    {
      for (int i = 0; i < 5; i++)
        test(i);
    }
  71. C++[ Go to top ]

    Whoops. I forgot to compile with optimizations.

    Revised C++ test result:

    Total time for iteration 0: 1960
    Total time for iteration 1: 1960
    Total time for iteration 2: 1960
    Total time for iteration 3: 1980
    Total time for iteration 4: 1970

    Still 4M memory usage.
  72. C++[ Go to top ]

    |
    | I forgot to compile with optimizations.
    |

    Ahh yes, but which compiler did you use? And which STL did you use?
    Come on. Fair disclosure!
    ;-)

    Come on now chaps, the point of this exercise, as I see it, has been somewhat lost (sadly). The issue wasnt really to determine the performance winner.

    The point of this whole thread (and its preceding one) was based around debunking the claim that some chumps (like our beloved friend) make that "C# is 8 times faster with 1/4 the code..".

    Now, I kid you not: you will have "technical" people (in positions of influence) claim exactly that as a reason for preferring .net over Java.
    You will hear such pearls as ".net is faster because its compiled whereas Java is interpreted".

    Cameron has shown that not to be the case.
    Rolf has failed to show otherwise.
    It wasnt a big surprise - but it was entertaining.

    -Nick
  73. Rolf and Paul Harvey[ Go to top ]

    Cameron has shown that not to be the case.

    > Rolf has failed to show otherwise.
    > It wasnt a big surprise - but it was entertaining.
    >
    > -Nick

    Reading Rolf's post to me is like listening to Paul Harvey (The rest of the story). They both quote their opinion's as fact, really don't have a clue, and both are irritating. To quote despair.com, "It could be that the purpose of their live?s is only to serve as a warning to others" ;-)

    -Pete
  74. C++[ Go to top ]

    Come on now chaps, the point of this exercise, as I see it, has been somewhat lost (sadly). The issue wasnt really to determine the performance winner.

    >
    > The point of this whole thread (and its preceding one) was based around debunking the claim that some chumps (like our beloved friend) make that "C# is 8 times faster with 1/4 the code..".

    Right. C# is not X times faster than Java and that is worthwhile debunking. Java and C# are 'pretty' close in speed with Java seeming to have an edge at the moment. My point is to challenge those who claim that performance of the langauge is so important to them (as support for using C# over Java becuase 'every microsecond counts' for example) and pointing out that if performance is really SO important, then they should not be using C# or Java since both are considerably slower than traditional languages such as C++/C. Performance only matters when it matters (i.e. when there is unacceptable delay to the user). When programming one has to consider the aims of
     - productivity
     - maintainability
     - robustness
     - performance

    Most people have long ago accepted that for most projects performance is not the most important thing and therefore abstractions such as 'functions', 'objects', 'iterators' that improve #1, #2, and #3 are worth tradeoffs with performance.

    Java and C# are nearly identical in all 4 areas. To argue over slight differences between the two is petty and silly. If performance really is SO important to one's project, then for heaven's sake, don't use Java or C#. They are both dogs compared to C/C++ and especially assembly.

    There is an example on optimizations in a book that I appoligize I can't remember ("Code Complete" maybe) where the guy is coding a compression algorithm in C and it is too slow (say a minute for his test case) and he optimizes it (loop unrolling, etc) and it is still too slow (like 21 seconds or something) so finally he hand codes it in assembly and it drops to less than a second, but of course the final result is horrendous in terms of productivity and maintainability and unless he tests it very thoroughly it will probably be succeptable to buffer overflows, etc (i.e it is not robust either). In this case of course it is worth it, but it seldom is. Productivity is king, which is why we have Java and C# in the first place otherwise we would still be doing assembly.
  75. Purdy's latest best numbers

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    BEA jRockit 8.1:
    java version "1.4.1_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02)
    BEA WebLogic JRockit(R) Virtual Machine
      (build 8.1-1.4.1_02-win32-CROSIS-20030320-1110, Native Threads,
      Generational Concurrent Garbage Collector)

    java -Xms128m -Xmx128m ManyPeople
    Total time for iteration 0: 5147
    Total time for iteration 1: 5829
    Total time for iteration 2: 5678
    Total time for iteration 3: 5738
    Total time for iteration 4: 5698
    Total time for iteration 5: 5799

    java -Xms128m -Xmx128m ManyPeople

    Total time for iteration 0: 5208
    Total time for iteration 1: 5888
    Total time for iteration 2: 5729
    Total time for iteration 3: 5788
    Total time for iteration 4: 5758
    Total time for iteration 5: 5728

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    I modified the C# source slightly

    --------------------------------------
    using System;
    using System.Text;

    namespace Purdy
    {
    // C# Create 100,000 people in an ArrayList and access them
    using System;
    using System.Collections;

    public class ManyPeople
    {
    public static void Main()
    {
    for (int i = 0; i < 100; i++)
    test(i);
    }
      
    public static void test(int iIter)
    {
    DateTime start = DateTime.Now;
    for (int i = 0; i < 20; i++)
    {
    new ManyPeople().Average();
    }
    DateTime finish = DateTime.Now;
    Console.WriteLine("Total time for iteration " + iIter + ": " + (finish - start));
    }

    private long Average()
    {
    Person[] list = new Person[100000];

    for (int i = 0; i < 100000; i++)
    {
    list[i] = new Person(i, "John " + i.ToString());
    }

    long silly = 0;
    for (int i = 0; i < 100000; i++)
    {
    silly += list[i].Id;
    }
    return silly / 100000;
    }
    }

    // Person.cs: a very simple guy
    class Person
    {
    int id;
    string name;

    public Person()
    {
    }

    public Person(int anId, string aName)
    {
    this.id = anId;
    this.name = aName;
    }

    public int Id
    {
    get { return this.id; }
    }
    }

    }


    --------------------------------------

    The results on my 2GHz machine


    Total time for iteration 0: 00:00:02.9742768
    Total time for iteration 1: 00:00:02.7539600
    Total time for iteration 2: 00:00:02.9041760
    Total time for iteration 3: 00:00:02.8841472
    Total time for iteration 4: 00:00:02.8841472
    Total time for iteration 5: 00:00:02.8641184

    ----------------------------------------

    Almost as good as C++

    Chameleon
  76. Almost as good as C++

    finally, this looks exactly like the code I wrote Saturday and performance speaks for it self.
    but you are still boxing with the finish-start and the iIter ;-)

    thank you Chameleon

    Cheers, Allan
  77. Where's my mistake?[ Go to top ]

    I copy&paste java code from http://www.freeroller.net/page/cpurdy/20030516 and the results on my 1.5Ghz machine with IBM J2RE 1.3.1 IBM (Win32 build cn131-20021107) are:

    Total time for iteration 0: 2110
    Total time for iteration 1: 1968
    Total time for iteration 2: 1969
    Total time for iteration 3: 1922
    Total time for iteration 4: 1781
    Total time for iteration 5: 1953

    I know that IBM JVM is fast :-) but these results are too much different from yours. Where's my mistake?

    Ciao
  78. Calibrate your system[ Go to top ]

    Hi!

    Your assumption regarding the same results is asbolutely wrong. This is not a matter of testing, number should be based for just specific metrics on specific machine. You should have the same machine, same hardware and same drivers. Even just system drivers for board can strongly influence results.
    That is why when you do the tests, then you can see number as absolute ones, but as relative and you should compare relative quota for each platform. You must run Sun's VM and IBM's VM and then compare Sun's numbers with those ones, as that guy posted. Then you've done calibration of your system and then you can calculate percentage for your tests regarding IBM's VM. This is really silly what i see here on testing discussion.

    Even the tests posted by the author of article are wrong as i wrote. There is no knowledge regarding what VM is doing on. MS's VM is very nicely optimized on mapping to CPU's registries and there are even no optimization on working with matrixs (as Sun's VM has) because as MS publish on MSDN, they have not matched their goals for that release of .NET Framework1.1. And we could speak about more details like CSE algorithms, Copy propagation, Constant Folding etc.
  79. Where's my mistake?[ Go to top ]

    I copy&paste java code from http://www.freeroller.net/page/cpurdy/20030516 and the results on my 1.5Ghz machine with IBM J2RE 1.3.1 IBM (Win32 build cn131-20021107) are:

    >
    > Total time for iteration 0: 2110
    > Total time for iteration 1: 1968
    > Total time for iteration 2: 1969
    > Total time for iteration 3: 1922
    > Total time for iteration 4: 1781
    > Total time for iteration 5: 1953
    >
    > I know that IBM JVM is fast :-) but these results are too much different from yours. Where's my mistake?

    No mistake. The IBM VM is just better for some tasks. I pointed this out the first time that the ManyPeople code was posted.

    Jim S.
  80. Almost as good as C++


    How do you conclude that? By comparing absolute numbers of your machine to mine!?!? Come on now, my machine is an old piece of junk. You need to run all the tests on you machine. You can't compare abolute numbers across machines. Sheesh.
  81. acti labores jucundi[ Go to top ]

    Hi Nick,

    The point of this whole thread (and its preceding one) was based around debunking the claim that some chumps (like our beloved friend) make that "C# is 8 times faster with 1/4 the code..

    Please Nick. This is the second time now. (by the way have you got the information from Dion yet, - about the false post?). I remember you from earlier as a hard arguer, but never "tricky", like Cameron.

    I never have said that .NET is 8 times faster than Java. What I said was:

    .NET is 8 times faster, 4 times more maintainable, and 2 times more productive than "the big J2EE servers with entity beans".

    And in this post: http://www.theserverside.com/discussion/thread.jsp?thread_id=19226#82244

    I explained what I meant by that:

    "And about the last issue (8 times faster), I come to that conclusion by the following reasoning: To make the wrong choice with EJB (for example, by follow Sun’s original recommendations) can make performance suffer more than 100 times or more. On the other hand, if you are very good, you can escape with a 50% performance loss. Therefore, making an educated guess about the skill of the average J2EE developer, I think that 8 times is a reasonable number.."

    It is this matter from Cameron that form the basis of these two threads:

    Cameron: "Regarding .NET performance, we had a thread on that, and I showed (using the .NET developer's own code) that Java was significantly faster...
    BTW - I tested with both .NET 1.0 and 1.1. FWIW - It averages between 10-15% slower than Java
    "

    It is this claim that is thoroughly refuted and debunked.

    About that .NET is 8 times faster with 1/4 of the code than "the big J2EE servers with entity beans", - that is when everything is fucked up by "well-meaning impractical theorists", that is another discussion.

    Anyway, it is nice to see that C++ is still the King. Now and then in Java publications, you can see “Java is now faster that C”

    Regards
    Rolf Tollerud
  82. babelfish[ Go to top ]

    tRolf: "I never have said that .NET is 8 times faster than Java."

    Translation: "Now that it's been shown to be obviously false, I need to back away from a few of my patently ludicrous claims."


    Cameron: "Regarding .NET performance ... It averages between 10-15% slower than Java"

    tRolf: "It is this claim that is thoroughly refuted and debunked."

    Translation: "The fire engine is red. No, it's yellow. Green. Maybe purple. Black is white. Mmmm, donuts."


    tRolf: "About that .NET is 8 times faster with 1/4 of the code than "the big J2EE servers with entity beans", - that is when everything is ?*@*!? up by "well-meaning impractical theorists", that is another discussion."

    Tranlation: "Quick! Change the subject! Before the rest of the people reading this realize that the last comment was a farce! Anybody here dislike committees? Impractical professor-types? Anybody ever get frustrated using emacs? Or vi? Or cshell? Please, someone help me change the subject! Somebody must dislike something!"


    tRolf: "Anyway, it is nice to see that C++ is still the King. Now and then in Java publications, you can see 'Java is now faster that C'"

    Translation: "Cameron was able to show Java beating .NET consistently, but .NET supports some sort of C++, and he hasn't shown Java beating real C++, so I'm still on the winning side! So I'm right! .NET is 8x faster than Java! Fire engine is red! Mmm, donuts."

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  83. OK[ Go to top ]

    Cameron,

    If this last post of yours is not marked as noisy, I promise I never post again!

    Regards
    Rolf Tollerud
  84. OK[ Go to top ]

    Cameron,

    >
    > If this last post of yours is not marked as noisy, I promise I never post again!
    >
    > Regards
    > Rolf Tollerud

    This looks like a cast iron guarantee to me.

    Bye Rolf, I'm sure we will miss you :)
  85. don't get your hopes up[ Go to top ]

    That was probably someone else posting in Rolf's name. Boy oh boy, that excuse comes in handy. ;-)

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  86. OK[ Go to top ]

    Cameron,

    >
    > If this last post of yours is not marked as noisy, I promise I never post again!
    >
    > Regards
    > Rolf Tollerud

    Come on, Rolf!

    Have you lost your temper? ;)

    Hard to fight an entire community, I see. :)

    Regards,
    Razvan Caraghin
  87. Mean, median and mode[ Go to top ]

    ROLF

    > To make the wrong choice with EJB (for example, by follow Sun&#8217;s original
    > recommendations) can make performance suffer more than 100 times or more.

    You mean that if you write code badly, then it might perform like a dog? Well, maybe you have a lot of experience in this.

    > ROLF
    > On the other hand, if you are very good, you can escape with a 50%
    > performance loss. Therefore, making an educated guess about the skill of the
    > average J2EE developer, I think that 8 times is a reasonable number..

    I have to admit you're spot on here. 50% is the generally agreed percentage, I saw it on a website or something. Or read it in a book. Oh no, I remember, I read it HERE, from YOU. So it must be true!

    Also I'm slightly worried that when averaging 100 and 0.5, you came up with 8. Is that like, using the ab-Normal statistical distribution or something? The Bell-end curve perhaps?

    Cheers, Chris
  88. Ya Pues![ Go to top ]

    |
    | What I said was...
    |

    Even what you now say that you said is not correct.

    If you actually had some experience with these technologies that you continually offer advice on, then perhaps you would actually get some respect for your opinions. Enough said really.

    |
    |It is this claim that is thoroughly refuted and debunked.
    |

    Maybe in your version of reality it is...

    |
    | .. blahdy blah... "the big J2EE servers with entity beans" ... blah blah
    |

    Zzzzz....

    -Nick
  89. C++[ Go to top ]

    Come on now chaps, the point of this exercise, as I see it, has been somewhat > lost (sadly). The issue wasnt really to determine the performance winner.


    Granted. Nonetheless, just for fun, gcj Java vs mono C# vs g++ C++ on a Linux box (P3 500):

    gcc C++ - 4 MB (Anick's code)
    Total time for iteration 0: 3400
    Total time for iteration 1: 3470
    Total time for iteration 2: 3490
    Total time for iteration 3: 3490
    Total time for iteration 4: 3490
    Total time for iteration 5: 3480

    gcj Java - 21 MB (Rolf's code)
    Total time for iteration 0: 9157
    Total time for iteration 1: 9363
    Total time for iteration 2: 8780
    Total time for iteration 3: 9146
    Total time for iteration 4: 8457
    Total time for iteration 5: 8188

    mono C# 19 MB (Rolf's code)
    Total time for iteration 0: 00:00:18.2441270
    Total time for iteration 1: 00:00:17.7636800
    Total time for iteration 2: 00:00:17.8811300
    Total time for iteration 3: 00:00:21.3182320
    Total time for iteration 4: 00:00:18.5320370
    Total time for iteration 5: 00:00:17.9877850


    - Marc
  90. C++... good[ Go to top ]

    BTW - I just noted that in the C# code a lot of time is spent in the concatenation part. I mean, if I replace ("John" + i) with simply "John" I get a 10x performance increase! Instead of 4.5 seconds as usual (on my dual proc 1.8 GHx xeon I get 0.5 seconds for one iteration). Ugh... so this "benchmark" is actually measuring the performance of the expression "John" + i.ToString() plus boxing.

    Anyway, I thought that is suspect that the C++ code performs that good... and the explanation seems to be the same string concatenation. The bug is not hard to spot. You write:

    >>> list.push_back(new Person(i, "John " + i));

    but I guess that "John" + i will be an invalid expression for i > 4. So, I guess you need to use sprintf instead... :-)


    Paul
  91. C++... good[ Go to top ]

    Anyway, I thought that is suspect that the C++ code performs that good... and the explanation seems to be the same string concatenation. The bug is not hard to spot. You write:

    >
    > >>> list.push_back(new Person(i, "John " + i));
    >
    > but I guess that "John" + i will be an invalid expression for i > 4. So, I guess you need to use sprintf instead... :-)

    You are right and when I use sprintf, C++ is only 50% faster than Java, which is pretty good showing for Java. Of course I am 'converting' Java code into C++ and not doing it in the natural way that C++ would work better with. For example, I could write a program in C++ that did some heavy bit manipulation and then we could see some large perfomance difference when someone tries to convert that to java.

    So yes this test is mostly just testing converting integers to string and concatenation and is not really testing the ArrayList much at all.
  92. C++[ Go to top ]

    This may produce faster results:

    long average()
    {
      vector<Person /* * */> list;
       
      for (int i = 0; i < 100000; ++i)
        list.push_back(/*new*/ Person(i, "John " + i));
       
      long silly = 0;
      for (int i = 0; i < 100000; ++i)
        silly += list[i]->getId();

    // for(int i=0;i<100000;++i)
    // delete list[i];

      return silly/100000;
    }
  93. Google is written in python..[ Go to top ]

    Very funny. Python does the URL crawler/server, but is not the heart, the engine.

    http://www-db.stanford.edu/~backrub/google.html
    '[] Most of Google is implemented in C or C++ for efficiency []'

    Engines will always be written in C/C++ since this is still the most efficient way for doing a lot of things. So still a lot apps in the heart are C++. Just check out this list:
    http://www.research.att.com/~bs/applications.html

    I do some stuff in Python and wrap stuff in C++ as soon as things need performance. Still python apps feel a lot more responsive than java apps (when my new IBM Thinkpad R40 is here this might change :-) ).

    Anyway, optimizing an app can reveal a lot more performance than just using a different programming language/platform, I mean things can easily get 10-100times faster if you think about the basic algorithms you use and their complexity.

    Still I do not understand why the linux community hasn't really launched massive apps in java for linux (since the evil empire ms has no stand)? I mean mainly desktop apps. I wonder why...
  94. Google is written in python..[ Go to top ]

    Very funny. Python does the URL crawler/server, but is not the heart, the engine.


    I did not know that. Guess I read some propaganda on slashdot or something and didn't attempt to verify it. Still even the fact that the crawler (which 'only' has to crawl a few billion pages ;-) is written using Python, but scales so easily because crawled is so well suited to be done in parrallel does illustrate the importance of scalability over raw speed.

    > Engines will always be written in C/C++ since this is still the most efficient way for doing a lot of things. So still a lot apps in the heart are C++. Just check out this list:
    > http://www.research.att.com/~bs/applications.html

    I agree. Which was my point. If you want speed, write it in C/C++. All this argument over speed of Java vs C# is needlessly petty and silly, since 'speed' is definitely not the reason to use either of these languages. If your most important criterion is speed, then you should not be using either one.
  95. I have expected that CRL and JVM with core libraries perform similarly. I can't see any performance optimization that CLR can use but JVM can not or vice versa.

    But in .NET platform, Microsoft uses native code, extends Windows kernel and SQL server. J2EE servers are implemented in byte code that runs on any standard JRE.

    For example, you can see in the benchmark that .NET performs mach better on Windows 2003 then on Windows 2000. I suppose that J2EE servers or Oracle 9i database don't performs so better on Windows 2003.

    So, it is natural that .NET platform performs better. But are Java based platforms close enough?
    For me, they are.

    Nebojsa
  96. A truly valuable tool[ Go to top ]

    This is great news because all my really serious applications are written entirely using ArrayList, with an occasional Map. I don't understand why there is so much concern about transactions, messaging or database activity on this site when most Fortune 500 companies are really interested only in the kind of results that ArrayList can bring to the table.

    I can't wait for a benchmark on the performance of Set ... I have one cutting-edge client who wants to abandon the realm of ordered lists but I'm concerned he may be too far out of the mainstream.

    :-)

    Folks, if you feel obligated to compare .Net and Java do a real comparison: build some equivalent apps in both frameworks and compare
    1) Performance
    2) Tool Support
    3) Maintainability
    4) Development Effort
    5) Total Cost of Ownership

    I honestly don't know how these would balance out now, or how they'll balance in a year or five years. I *suspect* that .Net would get the edge on tool support, developer effort (short term) and single-box performance, and that Java would get the edge on scalability, TCO, maintainability and development effort (long term).

    There are significant faults in .Net and Java/J2EE. I'd like to think that Java/J2EE has the edge in terms of experience ... we have years of headstart on the .Net crowd in thinking big, solving the real big problems.

    Of course, the main reason to move from .Net to Java is so that you can use Tapestry :-)
  97. Here is some tests I've done few weeks before to see how ArrayList compares with HashSet and LinkedList. By no means scientific experiment, just quick and dirty test to reassure myself (I wanted to use Sets more for my JDO collections and wanted to make sure it is not to expensive as they are HashMap based). I guess I'll stick with ArrayList (also need to test at what collection size List.indexOf() starts falling behind Map.get() but that's different story)

    Test is extremly simple and does nothing but create and populate tonns of collections with bunch of pre-created Integers instances and read them back. I gave my JVM tons of memory to avoid GC and and see how high memory consumption will go. I was mostly interested in small collections (20-200 items) but many of them. I included only final memory consumption here not so you cant see from these numbers but it was interesting that for both LinkedList and HashSet allocated memory grew steadily up untill it would gobble up all available memory and and GC would not kick in till the very last minute (looked like it all went to old generation pool althoug I do not know why - I dicarded old instances within my loop at once) And if I did not allocate enough memory it would blow up with out of memory exception before GC has enough time to free up some. On contrary ArrayList never took more than certain amount of memory and GC was working smoothly all the time

    Small collection size (40)

                 time(ms) memory(kb)
    ArrayList 5,218 62,154
    LinkedList 14,125 240,066
    HashSet 27,000 311,825

    the same but using using random inserts - append(index, object) rather than
    append(object):
    ArrayList 8937, 53591
    LinkedList 15047, 240066


    Larger collection size (200)

    ArrayList 4860, 47709
    LinkedList 18468, 290704
    HashSet 34391, 422282

    the same but using using random inserts - append(index, object) rather than
    append(object):
    ArrayList 11844, 47709
    LinkedList 25766, 290704
  98. I wanted to use Sets more for my JDO collections and wanted to make sure it is not to expensive as they are HashMap based


    In case you have found this out since you wrote this message, you should know that HashSets are HashMap based, but TreeSets are balanced trees. If the size of the set can change all the time, you are better off using those. The best case of a tree is not as good as the best case for a hash table, but you'll get much better memory performance.

    Guglielmo
  99. The real reason to choose[ Go to top ]

    Howard Lewis Ship says

    > Of course, the main reason to move from .Net to Java is so that you can use
    > Tapestry :-)

    I agree! And Velocity, Ant, JBoss, IDEA, etcetera, etcetera, etcetera.
  100. Oh my...[ Go to top ]

    "Claim: .NET Performance Still Seriously Lags Java"

    My first reaction to this title was... gee, I hope TheServerSide.com gets moderated soon to eliminate this sort of junk.
  101. right on, how to mention .net and java at the same sentence. ;-)

    i almost fell at my chair after 9...
  102. Cameron is pondering[ Go to top ]

    Cameron is pondering over "the top 10 reasons to choose Java over .NET". It will be interesting to see what he will dig up! (it will probably take a looong time)
     
    Personally can only think of three reasons!

    1) If you don not care about performance
    2) If you don not care about maintainability
    3) If you don not care about productivity.

    So come now Cameron, don't drag your feet - join the .NET fashion!
    after all, you do not go out with sunglasses from last year, do you?

    Or do you?

    Regards
    Rolf Tollerud
  103. trolf[ Go to top ]

    Performance?

    GCJ on Java if you concern is only performance. Pick one of the many tools for compiling java to opcode and have the finest level of optimization.

    As far as maintainability look at vast number of tools available to J2EE for just that. Look at sourceforge, freshmeat, jboss, oracle, bea, ibm, sun, etc. Where is microsoft? Playing catch up. Their greed to control has them in last place.

    Productivity? How many sites are developed in J2EE? How many sites are developed with dotnet? Point proven.

    Rolf,

       If you made a career on microsoft, place your upcoming bets carefully. Microsoft is too late in the game to affect the further exponential growth of J2EE no matter the marketing might. It's telling from their internal memos covering J2EE and Linux.

    Even the AFX team at Microsoft are having nightmares. Poor chaps are eating away at their finger and toe nails.


    btw, how about availability? Is that word even spoken within the microsoft underworld? guess not. Their products speak for themselves.
  104. I think Cameron's underlying point is that FUD is easy to produce. It's the spin of the initial headline that does the most damage. The test doesn't have to be accurate. It can be argued technically both ways. Those with the budget and the decision discount the post-headline churn because they know that geeks argue. Even so, it's good to have people like Rolf around to teethe on.

    What surprises me about these arguments is the focus on low level optimizations versus getting the logic right or general developer productivity. I think this comment is tongue-in-check or is it.


    <quote>I don't understand why there is so much concern about transactions, messaging or database activity on this site when most Fortune 500 companies are really interested only in the kind of results that ArrayList can bring to the table.</quote>

    Keep generating those headlines!
  105. Don't ban TR[ Go to top ]

    TR.
    It's like in 'Dallas', JR was a character everybody disliked but he let everybody else look really good. TR makes the best arguements for J2EE.

    Performance.
    If you haven't checked, hardware performance is going through the roof and with no stop sign ahead so all VM based applications(.NET and Java) will just get faster and faster. As somebody stated in earleir post, most performance bottlenecks come from I/O (database,network etc) anyway.

    C, C++, Assembly
    In addition to the item above, Java and .NET offer greater productivity (i.e. time to market) than C, C++ and Assembly so if we are building the same functionality but my app makes it to market faster and grabs the market share, your app becomes a nice exercise in computer science, so what if it's faster, being ahead gives me time to optimize the bottlenecks and gives me invaluable user feedback.

    P.S.: I wonder if TR was behind the infamous License 6 since .NET is so superior? :)
  106. Not using the same code[ Go to top ]

    For the Average() method he uses foreach loop in the C# code but a for loop in the java code with a cast. The foreach is not as fast as using the for loop with a cast - its more to make the code more readable and less error prone.

    It would be a more accurate comparison if the code used for both languages were as close as possible.
  107. As requested, I updated the benchmark results (on my blog) to include jRockit, as well as the suggested .NET optimizations:

    http://www.freeroller.net/page/cpurdy/20030519

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  108. Thanks Cameron. Although I don't really care about this microbenchmark nonsense, I usually learn something when reading your entries. I have a friend that was looking for arguments in favor of .Net, since the place he works in has been a Microsoft shop for years, and they're afraid to switch to Java. I understand they're worried. I first thought it was going to be a good idea to refer him to Rolf's statements, since some of them appear (at least to me) to make sense. And while some of his opinions are worthy (again, IMHO), he doesn't provide enough facts nor sources for use even for that people I believe he's trying to evangelize. A solid argument requires more than opinions. Again Cameron, you have given hard data in what I believe is a technical issue.

    Cheers.

    Javier
  109. Cameron: "As requested, I updated the benchmark results (on my blog) to include jRockit, as well as the suggested .NET optimizations:"

    What I was most concerned with (apart from adding fuel to yet another pointless debate) was the fact that no .Net-specific optimisations were (and still have yet to be) made (this is, afterall, a performance test). The biggest [baked-in] performance win .Net has over Java, regardless of the "JIT wars" that will inevitably ensue, is the use of value types. That 'Person' type was a perfect candidate for structifying, the ArrayList could have been ditched because the number of elements was a constant, and a 100,000 element Person[] could then have been created with no boxing or casting. You can't do that in Java, yet it's perfectly acceptable, even idiomatic C#.

    Couple that with the fact that no-one seems to know what the benchmark even benchmarks, and you've got yet another headline-grabbing bunch of arse.

    No offence :-)

    Jim

    Thoughtworks
  110. and a 100,000 element Person[] could then have been created with no boxing

    so true, no boxing occurs that way and while you're at it get rid of the foreach loop and use a plain for loop, or wait for the copy cat (Java 2 Platform, Standard Edition 1.5) then you can compare foreach loops ;-)

    Cheers, Allan
  111. What I was most concerned with (apart from adding fuel to yet another pointless debate) was the fact that no .Net-specific optimisations were (and still have yet to be) made (this is, afterall, a performance test). The biggest [baked-in] performance win .Net has over Java, regardless of the "JIT wars" that will inevitably ensue, is the use of value types. That 'Person' type was a perfect candidate for structifying, the ArrayList could have been ditched because the number of elements was a constant, and a 100,000 element Person[] could then have been created with no boxing or casting. You can't do that in Java, yet it's perfectly acceptable, even idiomatic C#.


    But then we would end up with two very different source codes, which would make this benchmark even more meaningless... :) Plus, all those otimizations, IMHO, would make the C# code less OO. Some people think its ok, some dont.
  112. Jim: "...no .Net-specific optimisations were made..."

    Henrique: "But then we would end up with two very different source codes... "

    Exactly. C# is not Java.

    Henrique: "Plus, all those otimizations, IMHO, would make the C# code less OO."

    Strongly-typed collections (in a strongly-typed system) are arguably more O-O than the weakly-typed ArrayList. Besides, the code couldn't really get any worse, could it? :-)

    Jim

    Thoughtworks
  113. The biggest [baked-in] performance win .Net has over Java, regardless of the

    > "JIT wars" that will inevitably ensue, is the use of value types. That 'Person'
    > type was a perfect candidate for structifying, the ArrayList could have been
    > ditched because the number of elements was a constant, and a 100,000 element
    > Person[] could then have been created with no boxing or casting. You
    > can't do that in Java, yet it's perfectly acceptable, even idiomatic C#.
    >
    > Jim

    Here's your *can't* do that in java

    private long average2()
    {
      Person[] p = new Person[100000];
      for (int i = 0; i < 100000; i++)
        p[i] = new Person(i, "John" + i);

      long silly = 0;
      for (int i = 0; i < 100000; i++)
        silly += p[i].getId();
      return silly;
    }

    And for the record the original timing was 2,804 sec (best of five loops)
    And with Person[] array the result was 1,723 (best of five loops)

    On Compaq evo N800v (1,6GHz)

    P.S.
    Person has a getId() method - so you can't structify it. Besides a decent JIT compiler will pretty much optimize away the getId() method anyway. I noticed no difference when I changed the field public and referred to it directly.

    Reverting to struct tricks would be 'premature optimization' in my book. The only thing to be gained here would be memory. The Person struct would probably take less memory than the Person object.
  114. First Last: "Here's your *can't* do that in java..."

    Java has structs now?

    First Last: "P.S. Person has a getId() method - so you can't structify it."

    Why not? Are we talking about the same language here?

    First Last: "Reverting to struct tricks would be 'premature optimization' in my book. The only thing to be gained here would be memory. The Person struct would probably take less memory than the Person object."

    Yes, we're talking about different languages.

    Jim

    Thoughtworks
  115. Jim Arnold wrote

    > the ArrayList could have been ditched because the number of elements was a
    > constant, and a 100,000 element Person[] could then have been created with no
    > boxing or casting. You can't do that in Java, yet it's perfectly acceptable,
    > even idiomatic C#

    *100,000 element Person[] could have been created with no boxing or casting. You can't do that in Java.*

    I don't know where've you been for the last 8? years. Arrays have been in Java since the beginning. And yes, it was faster with arrays as I reported.

    I'm no expert on C# and this shows. I thought that the C# structs were similar to C structs which is not the case. Lesson learned. C# structs can have methods.

    If you do the talk, can you walk the walk? Change the .NET Person to a Struct and compare the results. Share. See if there's difference in speed and/or memory consumption.

    And Jim - in general, would you really implement a class known as Person as Struct?! It doesn't sound to be a good candidate for extending to you?
  116. OK, last post from me - this has already gone on way too long.

    First Last: "I don't know where've you been for the last 8? years. Arrays have been in Java since the beginning."

    I was referring to structs, not arrays.

    First Last: "If you do the talk, can you walk the walk? Change the .NET Person to a Struct and compare the results. Share. See if there's difference in speed and/or memory consumption. "

    I just did a very quick comparison. First, with a class:

    E:\DOTNET>speedtest
    Total time for iteration 0: 00:00:04.9671424
    Total time for iteration 1: 00:00:05.1974736
    Total time for iteration 2: 00:00:05.1273728
    Total time for iteration 3: 00:00:05.2775888
    Total time for iteration 4: 00:00:05.0672864

    Now with a struct:

    E:\DOTNET>speedtest
    Total time for iteration 0: 00:00:03.9657024
    Total time for iteration 1: 00:00:03.8555440
    Total time for iteration 2: 00:00:03.9256448
    Total time for iteration 3: 00:00:04.0358032
    Total time for iteration 4: 00:00:04.0758608

    Memory for the class version fluctuated between about 20-45 MB, with the struct it was between around 14-22 MB.

    First Last: "would you really implement a class known as Person as Struct?! It doesn't sound to be a good candidate for extending to you?"

    Maybe if someone could explain exactly what the program is supposed to do, I could answer that. The Person has a name field that isn't even used, an ArrayList is used for a list with a constant size, the Average() method returns a number that's never used... and you want to debate the merits of structs vs classes? Okaaaay :-)

    Jim

    Thoughtworks
  117. Cameron tries with jRockit[ Go to top ]

    tRolf is fond of pointing out that .NET used less memory:

    I hate to remind you all that the tests show that "with the same amount of memory, .NET is faster.


    "However, to rain on his parade, I decided to re-run the jRockit test without specifying any memory parameters:

    java ManyPeople
    Total time for iteration 0: 7070
    Total time for iteration 1: 7380
    Total time for iteration 2: 6640
    Total time for iteration 3: 6830
    Total time for iteration 4: 6950
    Total time for iteration 5: 6850
    "

    With jRockit 8.1, this configuration uses 67MB

    This is the result (on my machine) for jRockit, if you set the heap size to 20MB:

    J:\bea\jrockit81_141_02\bin\java -server -Xms20m -Xmx20m ManyPeople
    Total time for iteration 0: 16043
    Total time for iteration 1: 15341
    Total time for iteration 2: 15022
    Total time for iteration 3: 14941
    Total time for iteration 4: 14951
    Total time for iteration 5: 14931

    .NET results:

    ManyPeople
    Total time for iteration 0: 00:00:11.2561856
    Total time for iteration 1: 00:00:11.7168480
    Total time for iteration 2: 00:00:10.9056816
    Total time for iteration 3: 00:00:10.8756384
    Total time for iteration 4: 00:00:10.8756384
    Total time for iteration 5: 00:00:10.8956672

    .NET uses 18MB, Java uses 26MB.

    So.

    Cameron: "What tRolf doesn't seem to grasp is that the memory isn't "needed" by the JVM (as is evidenced by the fact that the program can run with a 20MB heap, for example), but the JVM will manage memory much differently when it has that much. In fact, it becomes much more effective with even larger heaps..

    I just wonder, if that is true, how come the performance difference just adds up - the more complicated scenario, the more performance difference? Remember, the orginal thread for this discussion was "NET webservices outperforms J2EE webservices in new test".

    Regards
    Rolf Tollerud
  118. Rolf please retest[ Go to top ]

    Rolf,

    Intresting results, I see you pointed to J: (assuming that is a network share) for your JRocket install would you please re-run your test with a local copy of JRocket and see if the test performs the same.

    Thank You
    Jim Tyrrell
  119. Rolf please retest[ Go to top ]

    Jim,

    "Intresting results, I see you pointed to J: (assuming that is a network share) for your JRocket install would you please re-run your test with a local copy of JRocket and see if the test performs the same."

    It is already a local drive!

    Henrique Steckelberg: "But then we would end up with two very different source codes, which would make this benchmark even more meaningless..."

    I have to agree with Henrique here, the meaning of this test was not to optimize.

    Regards
    Rolf Tollerud
  120. trolling for trollerud[ Go to top ]

    Rolf: J:\bea\jrockit81_141_02\bin\java -server -Xms20m -Xmx20m ManyPeople

    I missed the part where you ran .NET with a 20MB cap. Could you re-post that command line? Also, while you're at it, could you post the link to the enterprise server that comes configured with only 20MB of RAM? Also, did you run .NET on top of Windows 2003 on top of that enterprise server? Thanks for the info!

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  121. FTp of the code[ Go to top ]

    Guys,

    Can a FTP site be created where all of us could get the programs that are running and run them and independantly verify the results? I would also suggest the sources, so some could compile this and make sure all is kosher.
  122. the code[ Go to top ]

    Jim,

    You can download both source and bin from:

    www5.brinkster.com/rolftollerud/ManyPeople.zip

    To John Davies,

    This post (#83120) is not mine! I have reported to Dion but maybe his away or something.

    Regards
    Rolf Tollerud
  123. the code[ Go to top ]

    You can download both source and bin from:

    >
    > www5.brinkster.com/rolftollerud/ManyPeople.zip
    >
    > Regards
    > Rolf Tollerud

    Thx Rolf!

    My Results
    .NET 3,555 sec (best of first five) (just executing the supplied exe)
    Java 2,824 sec (best of first five) (Running through IntelliJ IDEA 64MB)
    Java 2,974 sec (when max mem set to 20MB - taskmanager reported 19,3MB for .NET)

    Windows XP professional (countless updatepacks)
    Sun JDK 1.4.2b
    1,6GHz mobile P4

    The memory consumption is hardly comparable since most of the .NET libraries are cached by the system, whereas the running Java program includes all the needed libraries too. This will - however - change in 1.5 where shared libraries can be used. That works on OS X already.

    Let's keep the thread alive, shall we? ;-)

    P.S.
    As you can calculate:
    .NET was only 20% slower when run with 'same' memory settings. Not bad.
  124. fantastic results...[ Go to top ]

    Please explain why you have the same result (2,824 vs 2,974) for 64MB heap size as for 20MB?

    On my computer, there is a whole 60% performance difference between those settings.

    Guess we have to wait for some more results then?

    Regards
    Rolf Tollerud
  125. the code[ Go to top ]

    Let's keep the thread alive, shall we? ;-)

    yes this is absolutely pointless continuing this thread, did ~anybody~ read Message #83057 and #83063, it shows the opposite, .net faster, java slower, but improves with -Xmx128m, but still fails to beat .net.
    The guy who wrote the .net code, clearly don't know jack about strongly type collections and boxing/unboxing, but he made it all the way to tss. hero by accident :-D.

    the code mr. Rolf posted, is not even half the optimazation you can do with the code.

    I rewrote the code so that NO boxing occurs, rewrite the datepart, use Int32 instead of int's etc.

    >Plus, all those otimizations, IMHO, would make the C# code less OO. Some people think its ok, some don’t.
    right, how much less OO does the code become when taking strongly typed collections and boxing in consideration
    so poor C# OO design is great for performance and good Java OO design is bad for performance >>:).

    I am out of here.

    cheers, Allan
  126. the code[ Go to top ]

    not even half the optimazation you can do with the code

    Why not compare some 100% identical code then - like this for example ?

    public static void Main() / main(String[] args) {
        for(;;) test();
    }

    public static void test() {
        DateTime start = DateTime.Now; / long start = System.currentTimeMillis();
        int[] iii = new int[40];
        for(int i = 0; i < 40; i++) {
            iii[i] = fib(i);
        }
        DateTime finish = DateTime.Now; / long finish = System.currentTimeMillis();
        Console.WriteLine((finish - start)); / System.out.println(finish-start);
    }

    public static int fib(int n) {
        if (n <= 2)
          return 1;
        else
          return fib(n-1) + fib(n-2);
    }

    C# :

    00:00:06.7952785
    00:00:06.8055900
    00:00:06.8159015
    00:00:06.7849670
    ...

    Java HotSpot(TM) Server VM (build 1.4.1_02-b06, mixed mode) :

    4708
    4699
    4698
    4669
    4678
    ...
  127. the code[ Go to top ]

    not even half the optimization you can do with the code

    >Why not compare some 100% identical code then - like this for example ?
    you're still boxing with the DateTime code, but ok.

    if so, please change your if (n<=2) to if(n<2) !??!
    and replace the fib function with this function:

    public static int fib(int n)
    {
    return (n < 2) ? 1 : fib(n-2) + fib(n-1);
    :-}

    ok back to work now, Allan
  128. the code[ Go to top ]

    ups sorry, you guys don't have the '?' :-) got carried away here.
    nothing to see here, move on.
    /Allan
  129. the code[ Go to top ]

    and replace the fib function with this function...

    What is the difference as soon as code is the same for both C# and Java ? not to mention that your version will produce an incorrect result for 2, assuming that teh purpose of the function is to return fibonacci number that is.
  130. An interesting qoute from the MS .NET Framework license:

    "* You may not disclose the results of any benchmark test of the .NET Framework component of the OS Components to any third party without Microsoft’s prior written approval."
  131. This is not true and test is bad[ Go to top ]

    The test is not right. It isn't even test, but one app without any background related to testing algorithms.
    Java is slower in some areas and in some faster. JVM GC is designed with different layout, it uses 2 survival spaces (small parts of memory, there are many allocations but its effective for some type of applications, for example serverside, when you have thousands of clients working with system just for a short time) and this design makes it slower (too many interuptions by GC, when other theads are stoped, for GUI is this design terrible). .NET has different aproach, with additional generations in GC.
    But JVM has excelent analysis of inlining and optimization of recursive calls. Here is JVM really great and CLR is out.

    See some tests here:
    http://www.techware.cz/performance.htm
  132. Folks,

    I've got a new benchmark that compares java with C#.

    The problem with Cameron Purdy's benchmarks are:

       1. It's not a "Real Life" benchmark.
       2. It's overly simplistic.
       3. It emphasizes numerical computation over symbolic manipulation.
       4. It doesn't accentuate the performance advantage of Java and C#.

    So, without much adieu, I present the "Ultimate Java versus C# Benchmark":

    http://www.freeroller.net/page/ceperez/20030520#p_the_problem_with_cameron
  133. In the interests of full disclosure, there's an issue with compiled regular expressions in .Net - expressions are compiled into dynamic assemblies, which can't be unloaded until the AppDomain is torn down. Creating thousands of compiled regex expression at a time will naturally bring this issue to the fore. The obvious (albeit counter-intuitive) optimisation is to remove the Compiled flag.

    So, the C# results should at least be printable, if still fairly pathetic.

    Jim

    Thoughtworks
  134. Jim,

    Good catch, unfortunately not many .NET programmers know this! The problem is all over the place, that is running embedded script languages etc.

    Anyway, ever wonder what the results would be if you turned off the "optimization"?

    You can see it for yourself, just run the code. .NET 1.0 or 1.1 doesn't matter. Like you said, still fairly pathetic!

    Carlos
  135. Sorry Purdy.

    http://www.tpc.org/tpcc/results/tpcc_perf_results.asp?resulttype=noncluster

    Chamelon
  136. Hi Chamelon,

    Why are you apologizing to me? I think it's great that Microsoft's OS and database software is getting better, and that Intel-based servers are getting better. How does that hurt me or my customers?

    You seem to be very desperate to have Microsoft "win" at something to make you feel better. Trust me, they'll do fine without the support of religious fanatics like you.

    And what does the link have to do with this farsical thread? First, your link had nothing to do with .NET. Second, and more importantly, this thread is limited to the abuse of Java/JVM and C#/CLR micro-benchmarks to prove pointless points. You obviously misunderstood the purpose of this entire exercise.

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  137. IT IS OK.[ Go to top ]

    No need to be apologetic. Nothing personal.

    I am sure that "TCP-C is not relevant" in the Java realm
    is suddenly not relevant again.

    No comment on "how short the reign was - 2 weeks" !

    Anyway - stress testing string concat() & toString() does
    not establish supremacy in the enterprise applications.

    chameleon
  138. IT IS OK.[ Go to top ]

    "Anyway - stress testing string concat() & toString() does not establish supremacy in the enterprise applications."
    >> Get a life mate!!!
  139. Chameleon,

    Wrong again! Look at what OS those machines are running on.

    64bit Windows 2003, last I heard .NET doesn't run on them!

    Carlos
  140. Yes - we are all blind[ Go to top ]

    Emperor has no clothes !!!
  141. Funny :)[ Go to top ]

    Hi,

    I am still wondering how they achieved much better result the same hardware & software. Must be some MAGIC? :)

    But the funny thing is, that if you compare total server software license costs, the HP+Windows is 1,25 mln $ and IBM is 0,63 mln $.

    So if anyone runs IBM software on this machine, could be able to achieve a bit better price/performance. :) If it is possible (Linux???).

    Oh, and BTW, there is no .NET runtime for this Windows version. So sorry...

    Best regards,
    Piotr
  142. TPC Benchmarks[ Go to top ]

    Just a few notes on the benchmarks

    1) check out the date for the Fujitsu implemetation. 08/28/01 .... that is quite a long time that it was nr 1 and its was on solaris 8. I call this impressive.
    2) The TPC Monitor is still COM+ for all the Microsoft implementations.(Yes I noticed other ppl already said no .net for the 64 bit yet.)


    Hendrik
  143. Oh good grief....[ Go to top ]

    <chameleon>
    http://www.tpc.org/tpcc/results/tpcc_perf_results.asp?resulttype=noncluster
    </chameleon>


    This is ridiculous - the HP benchmark has 64 Intel Itanium 2's, against the IBM setup of 32 IBM Power 4's.

    I.E.: One box has twice the number of processors of the other one, and the processors are of a different type.


    So the conclusion that you intend to draw about the respective capabilities of the software loaded in the boxes is... ?

    "Dearly beloved, we are gathered here today to mourn the passing of the Scientific Method. A direct descendent of Galileo Galilei, its death was sadly long and drawn out, stifled as it was by an avalanche of meaningless marketing material. It will not be missed, as most of the time it only got in the way of a good argument."

    /david
  144. dual core[ Go to top ]

    David,

    The IBM CPU is a dual core.
  145. dual core[ Go to top ]

    <chameleon>
    The IBM CPU is a dual core.
    </chameleon>


    Which, I think, proves my point quite nicely...

    /david
  146. Sorry guys, but even as i was a promoter of Java in eastern europe and i worked with many guys in Java industry (like the founders of Netbeans or Systinet) i'm sad about to see this fanatism. Why want you to fight against something? Dont you remember when for example C/C++ community was sending jokes on Java low performance? It was completely useless and unfair, the same as it is with this discussion.
    Your test is not correct, as i wrote in my last post. I send link to my tests, they were running for many hours and i've counted average values, so there are no peeks. Even i could write a type of "benchmark" to show where java is extremely slow (like this one on list http://www.techware.cz/tests/list.htm or this one on array access http://www.techware.cz/tests/array.htm). But should i say, java i slow? NO! I would not be a professional but just fanatic to promote JUST my opinion and not professional searching for truth. The same i feel on those tests and the same it is with C#, world is more complex and IT technologies are VERY complex.
    .NET has a very nice performance on specific tasks, where java is out. But this can be done and tested JUST in case you know something about JVM and CLR architecture and about JIT (how it works and how it optimizes the code). Those tests are absolutelly irellevant. And it's sad, that its going to be more fanatic bogus and not serious discussion without any attacks to anybody to any company to any person. I wrote many scientific articles on JVM features and it's weakness, so please, try to discuss it with serious matter and not like this. Otherwise this will be just another type of server where many people cries that JUST they are right and just THEIR idea can save the world and anything else is wrong. I dont want to see Java as another closed MS world. I'm trying to work with both to promote open platforms and serious cooperation. Maybe i'm naive with this view, but for too many clients (especially banks and telcos are my clients) this works for many years already.
  147. What the?[ Go to top ]

    I wonder what a shrink would make of this dicussion? :-)

    Egos egos everywhere...

    As a programmer I like dot net, I think it's good java has some competition. Both will benefit. Neither are going away anytime soon.
  148. Jan,

    Yes, each platform has its strengths and weaknesses, I pointed it out on my regex benchmark. However, if you look at the code for java and C# they are almost identical. In your List benchmark they are not, you've actually implemented your own version of a linked list that was specialized to primitive ints. However, could you not have used C#'s LinkedList class? Oh? You can't find one in the libraries?

    Then you go around claiming that C# is vastly superior. The only true conclusion that I can find in your benchmarks is that C# is better at array access. Afterall, you used an almost identical implementation.

    Point is, you can't go claiming you want an "honest" discussion, at the same time providing deceptive charts. Same goes with Microsoft, you can't say you want fair benchmarks at the same time do this: http://crowbar.dnsalias.com:443/crowbar/000213.html
  149. Hey that reminds me, another nice benchmark, compare random inserts, deletes and updates on a List.

    In Java use what's available (i.e. LinkedList)

    In C# use what's available (i.e. ArrayList)

    Guess who's going to win?
  150. Hi!

    Yes, some of your points are right.
    Also I posted second test on array access, also you can see other tests on object instantiation etc etc. There are also the similar nearly the same source codes in C# and Java. And there are different results in performance. Just check my tests, like strcat, multithreading. What i see as the worst thing in .NET regarding performance are exceptions. Those are implemented much worse then in Java. But other parts are the similar ones.
    And the list i mentioned because THOSE tests (like you wrote on regex) are on implementation. NOT on performance of JIT or VM. This is the difference, you have to see and what is very important on performance of J2EE platform. Those tests could be useless when you create bad platform layout (for example i'm the opponent of EJBs and always when i've discussed with engineers from sun i propose other solutions, not this one).
    Regarding list libraries :)) its funny, but i cooperated on many of those implementations, so even in such a case i would use just my own work ;) (but not in case you think about IBM's implementations or any OSS ones ;) ).

    Have a nice day.
  151. Deceptive charts[ Go to top ]

    Just regarding the charts. Those are not deceptive!
    They are correct and you can test it by yourself. I would ask you not to claim my chart is deceptive when you can see it by yourself.
    It seems that for you is deceptive something what is not the same as your claim.

    You've not even read the second test i've posted and you say something about "deceptive". Please, try sometimes to forget about your war against something or somebody. There is no enemy, just crazy people create enemies from the other ones who have different view on the world.

    Try to be honest and do those tests. And if you can send me some more tests (even like regex) to create correct analysis on performance of VMs, it would be fine. But dont start the "holy war".
  152. Anybody can send me better impl.[ Go to top ]

    Just final comment...if you would have better implementation on any of tests i published, please, send it to me and i change it immediately.
    This is how my site is working, its open to anybody and if any anybode else would send me better implementation with better results on Java or C#, they'll will be changes. I'm trying to make those tests and reliable and not to do any "holy war". I like both, Java and .NET and see them as excelent to work together. THose tests are not against ANYTHING! They are for information for programmers what they should be aware off. No holy war, just technical stuff.
  153. Some little suggestions[ Go to top ]

    Hello,

    Some suggestions to benchmarks on your site.

    First - if your benchmarks are to test JVM vs CLR, so why in list operations you use JDK LinkedList vs super-fast C# int-list implementation written by yourself? I would suggest either changing Java implementation to use your list, or to make the test running on real Objects instead of ints. Otherwise you're not testing list operations but primitive types vs oo types.

    Second - in your method call test, i would suggest testing some more cases, like 'final' or 'static' methods in Java, and polymorphic calls (inheritance and interfaces). I would bet HotSpot would win in these scenario. Which is much more real-life btw (anyone not using interfaces?).

    Third - if you test not only VMs, but also JDKs, please add a test comparing Regexps. :)

    Best regards,
    Piotr
  154. I did a bit of investigation on this. It is true that using the compiled flag will decrease your perf if you're only doing a small number of matches, and that is one of the things going on here. But there's also something else going on.

    It's fairly common when people write regex code for them to create the Regex, use it, and then throw it away. To try to make this a bit faster, the .NET Regex class saves their parsed version of a regex away in a hash table, and then when somebody creates a new instance of Regex, they look in the list to see if it's there, and use it. Most apps use a fairly small number of regexes, and this can give a nice speedup.

    In this benchmark, however, this optimization works against it, as the Regex class creates a really large hashtable and has to search it every time, but never finds the regex. That's why it's so slow. There is currently no way to disable this optimization.

    Whether the optimization is a good idea for most code is left as an exercise to the reader.

    Eric Gunnerson
    Visual C# .NET
  155. Well I rest my case.

    Folks, here you find a perfect case study of why Java is better than C# or .NET.

    (1) It takes a Microsoft Engineer to discover what's wrong, after all we aren't privy to the code. With Java you have the source so you can find out yourself.

    (2) This is a common microsoft tactic, optimize for the small case so you look good for small benchmarks, however try scaling it then you're in trouble.

    (3) Problem now is, when is this problem going to be fixed? With Microsoft you'll have to wait for the next release. With Java, well in the case Regex has a problem there are several open source alternatives to choose from (i.e. Oro, JRexx, JRegex etc.).

    Hope you all learned your lesson, if you want scalable applications you've got to see the source, don't do premature optimizations and have alternatives. Reliance on one vendor places unnecessary risks to the success of your project.
  156. How rabid are we ?[ Go to top ]

    Yeah, Lets kill the messenger.

    Java cant do anything wrong, Sun mmmmm.

    I hate Microsoft, wah wah wah

    chameleon
  157. rabid chamelons[ Go to top ]

    Chamelon,

    Eric's a nice guy and all (he really is), but is he always going to be around to help identify your specific application problems? I hate to say it, but Carlos has a really good point. With .NET, you either rely on the documentation (no good in this case), you reverse-engineer the platform (illegal), or you file a report with Microsoft India and wait for the next release (averaging about every six months) to see if anyone bothered to fix it. At any rate, unless you're a real hacker and you break the license, you can't diagnose what the problem is, and you can't fix it.

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Easily share live data across a cluster!
  158. It is not all that desparate[ Go to top ]

    .net is at 2nd rev (1 yr after release), java 5/6th rev (6 years after release).

    I accept the maturity part.

    Lot of things are just a test of time.

    Things in the MS .net land are not exactly designed with this kind of
    limitations in mind.

    Any way, there are a lot of hints in SSCLI as source. You can use ILDASM
    to see what is going on.

    If you have a MSDN license (if you purchased vs.net), you can open a case
    to resolve a problem and do a work around.

    In the sun java land, how many bugs are marked "will not fix" ?
    When you get a fix, you wait till the next rev.

    Java/sun is no different here.

    Chameleon
  159. We love benchmarks, do we? :-)[ Go to top ]

    OK, I would say that every benchmark contains something that you can learn from. From some benchmarks you can learn a lot, from others, probably less.

    But I think you opinions are exagerated. Let's follow some common sense here.

    >>> (1) It takes a Microsoft Engineer to discover what's wrong, after all we aren't privy to the code. With Java you have the source so you can find out yourself.

    For the source of the Regex class, you can check this link for example. You can see there the same approach as Eric Gunnerson described (caching the compiled regex expressions). I guess that a lot of .NET details can be learned by looking at the SSCLI source.

    >>> (2) This is a common microsoft tactic, optimize for the small case so you look good for small benchmarks, however try scaling it then you're in trouble.
     
    Oh yeah, the fact that regex is slow in your code is a common MS tactic :-) Who is spreading the FUD here? :-)

    >>> (3) Problem now is, when is this problem going to be fixed? With Microsoft you'll have to wait for the next release. With Java, well in the case Regex has a problem there are several open source alternatives to choose from (i.e. Oro, JRexx, JRegex etc.).

    Why is this a problem? Just use the right tool for the right job. .NET doesn't force you to use his own classes - anyone can write his own class libraries for .NET and not only in C#.

    BTW, I would be good to know if Oro, JRexx, JRegex etc. can be compiled in J#?

    >>> if you want scalable applications you've got to see the source

    Not sure if seeing the source of the underlying platform makes your app more scalable! Oracle, DB2, Weblogic, SQL Server, are good counterarguments. That said, seeing the source is definitely a good thing...
  160. We love benchmarks, do we? :-)[ Go to top ]

    For the source of the Regex class, you can check this link for example. You can see there the same approach as Eric Gunnerson described (caching the compiled regex expressions). I guess that a lot of .NET details can be learned by looking at the SSCLI source.


    What kind of license do I have to sign?

    >>> (2) This is a common microsoft tactic

    I'm sorry, I had thought that was common knowledge.

    >>>>Why is this a problem? Just use the right tool for the right job. .NET doesn't force you to use his own classes.

    Rewrite a Regex library? Give me a buzz when you've finished that porting effort. While your at it, please port the thousands of other open source java projects you otherwise need for a "real" project.


    >>>> BTW, I would be good to know if Oro, JRexx, JRegex etc. can be compiled in J#?
    A better thought, Microsoft should just ship the JVM.

    Another thought, how is it that a bunch of opensource volunteers (people who do this in the free time) can write a regex package that out performs a paid employee at Microsoft (someone who does it for a living). Could it just be that there's no correlation to the amount of money you spend and the quality of a project. After all, isn't this part of the core library of C#? Isn't this already the second iteration of the project? Or could this just indicate a redistribution of priorities at Microsoft?
  161. We love benchmarks, do we? :-)[ Go to top ]

    The .NET train is comin'! Jump on before it's too late!
  162. Shared Source CLI[ Go to top ]

    What kind of license do I have to sign?


    You don't have to sign any license for SSCLI. You can download it from the link below. There's a "license.txt" in the tar file that says what you can do with it.

    http://www.microsoft.com/downloads/details.aspx?FamilyId=3A1C93FA-7462-47D0-8E56-8DD34C6292F0&displaylang=en#filelist
  163. Shared Source CLI[ Go to top ]

    Maybe you want to share with the community the restrictions imposed by the license.
  164. Shared Source CLI[ Go to top ]

    Hi Carlos,

    The text of the Shared Source license is right here: http://msdn.microsoft.com/MSDN-FILES/027/002/097/ShSourceCLILicense.htm

    Thanks,
    Adi Oltean
    Windows Server 2003
  165. Dot Net will not replace Java[ Go to top ]

    Dot Net is dependent on a single vendor, microsoft, where as Java is vender independent. As long Dot Net is vendor dependent it is not going to replace Java based technologies.