Slashdot Mirror


Does C# Measure Up?

An anonymous reader queries: "Windows::Developer is offering a detailed, quantitative examination [free login required] of C#'s performance versus Java, C, C++ and D. 'Overall the results were surprising, although perhaps unexciting, in showing that C# (and to a less extent Java) is, to a good degree, on a par in efficiency terms with its older and (presumed to be) more efficient counterparts C and C++ at least as far as the basic language features compared in this analysis are concerned,' writes the author, Matthew Wilson. I'm only an amateur coder, and confess to not understanding most of the two-part article. I'd love to hear how true programmers view his results, which are too wide-ranging to summarize easily here. How about it Slashdot, as this special edition asks, 'Can C# keep up with compiled languages like C, C++, and D or byte-code based Java?'"

While we're on the topic of C#, rnd() queries: "It's been a while now, since Mono and DotGnu have begun eroding the market power of Microsoft by creating open source implementations of C# and the Common Language Runtime. Over the weekend I loaded Mono and did some informal benchmarking of object creation, intensive message passing, massive iteration, etc., and the results show that Mono is about 90% as fast as Microsoft's implementation after a very short time. I now want to switch my .NET development over to Linux/Mono exclusively, but I want to first settle on a free alternative to Visual Studio .NET 2003. Any suggestions?"

34 of 677 comments (clear)

  1. In Java's case ... by Anonymous Coward · · Score: 2, Interesting

    Hotspot is really good about compiling bytecodes down to the native machine language. That code is real honest to goodness native code, and will execute at approximately C++ speed.

    Why use anything else?

    - David

    1. Re:In Java's case ... by Anonymous+Brave+Guy · · Score: 2, Interesting

      I don't think C++ programmers have ever underestimated the value of garbage collection; Stroustrup mentions it himself in several relevant texts, and garbage collectors have been available for C++ for years, for those who want them. Of course, garbage collection isn't nearly so important in a language with automatic variables and deterministic destruction, which is probably why few people actually use those libraries.

      C++ and Java will never be the same language, or even close. They are aimed at two different markets, they have different strengths and weaknesses adapted to those markets, and it's rather unlikely that those markets will converge. The similarity pretty much ends at syntax and basic OO concepts.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    2. Re:In Java's case ... by pyrrho · · Score: 4, Interesting

      but you have to remember that C++ is designed to open up the power of the machine to you, not make you think a particular way or be magical for you.

      The onus is on the "our language does it for you" crowd because you were not supposed to say "oh, you have to understand how the VM is working"... right?

      Of course, in the end, all languages will have to tell us this "oh, yes, well, you have to know something". Of course you do! It will always be this way.

      So choose the most efficient and effective language for you and learn it well, learn a different one if called for, etc.

      At least, I take this to be apparent.

      PS: "pyrrhonist"... right on!

      --

      -pyrrho

    3. Re:In Java's case ... by pyrrhonist · · Score: 3, Interesting
      but you have to remember that C++ is designed to open up the power of the machine to you, not make you think a particular way or be magical for you.

      I guess any language ends up indirectly making you think in a different way. Maybe that's the magical part.

      The onus is on the "our language does it for you" crowd because you were not supposed to say "oh, you have to understand how the VM is working"... right?

      Well, my point was that the languages are different in more ways than many C++ programmers (or Java programmers) realize. For instance, many C++ programmers think that finalize methods are destructors, and many of them use finalize incorrectly because of this. Then some of these programmers choose to complain loudly about Java, when the problem lies with them. They need to learn a new paradigm or their programs will continue to function incorrectly. There are definitely best practices in C++ that are bad ideas in Java.

      Obviously, this works in reverse, too. You can't go from Java to C++ without changing your thinking as well. Many Java programmers have made this mistake.

      Of course, in the end, all languages will have to tell us this "oh, yes, well, you have to know something". Of course you do! It will always be this way.
      So choose the most efficient and effective language for you and learn it well, learn a different one if called for, etc.

      Yeah, I agree. I use languages as a tool, not a crutch. If I see a problem that is better represented by Perl than Java, I'll use Perl. Or Python, or 6502 assembly...

      PS: "pyrrhonist"... right on!

      I like yours too. Pyrrho was cool.

      --
      Show me on the doll where his noodly appendage touched you.
    4. Re:In Java's case ... by StillNeedMoreCoffee · · Score: 2, Interesting

      "Inheriting from Object only solves the absence of multiple inheritance in Java."

      I beg to differ the inheritance from Object has nothing to do with the mulitiple inheritance problem with C++. Interfaces in Java which allow you to define the functionality of a type without the conconmitant problems with name ambiquities of commonly inherited instance variables.

      The common Object class comes from Smalltalk where Object Oriented programming stems. It allows truely generic collection classes. That allows them to be written once and re-used as any ADT should. The generics added to Java allows the programmer to take advantage of the strong typing (they could with downcasting), and the re-use of the library. If you are concerned about code size. You could have an application in C++ with say 100 queues. With the template system in C++ you would have 100 different classes each implementing a queue. A major waste of runtime realestate. So Templates are not free.

      Template solve the problem that C++ had before templates, You had little or no code reusue because of the strong typing. If you wrote a Queue, you had to copy and modify it to create a int queue or a queue of your own object types. This was very cumbersom and a major hole in the languages capabilities when it first came out. Without templates the language was not very useful. C++ did not have reflection until later either. So its OOPs capabilities were crippled at the start and patched.

      It is true that C++ is usually used for non-oops or hybrid code that is designed to minimize overhead. There is a large class of problems, a very large class of problems that lend themselves to an OOP's approach. It depends on the job your in. You may just be solving problems that need extreme tuning. You probably just don't see the rest of the world.

      The power of the OOPs model is similar to the power of Databases. When Databases first came in, they were hugely expensive and very slow. But the problem that they solved, that is disconnecting the logical interface from the physical implementation made companies adopt DB's even then. They were spending more time maintaining old "tuned" code that they were not able to get anything new done. Then IT took off because they had a model for data that was more expressive and safer and more maintainable and robust. OOPs is the same model for programs and has the same benefits. It is much more cost effective to write something as ADT's and buy faster hardware than to code in a less maintainable form on slower machines, certainly for the long term it is many orders of magnitude better.

  2. Re:jump off the bandwagon by trompete · · Score: 3, Interesting

    to add....

    GUI development isn't that bad in Visual Studio. In fact, it is easy as hell. With emulators like Wine available, it makes sense to develop the software with Visual Studio and its amazing debugging tools for WINDOWS and then use Wine to run it on Linux.

    One could use the GTK and GNU-C to develop multi-platform software in the first place, but then you are dealing with the parent poster's problem of debugging on multi-platforms, not to mention that GTK sucks under Windows (Anyone else use GAIM?)

  3. What's with all of the bellyaching about speed? by defile · · Score: 5, Interesting

    OK lets get a few things settled.

    Given: two identical applications; A, written in low level language like machine assembly, C, or C++; B, written in high level language like Java, Python, VB, hgluahalguha.

    If the application is high in CPU burn (lets call it X), like oh, for (i = 0; i

    If the application is copying a very large file using basic read/write system calls and large enough buffers (lets call this Y), A and B will have very similar performance.

    If the application is printing hello world, they will have similar performance, although the startup costs for B may be higher, and A will probably finish executing faster.

    MOST applications written today are written to solve for Y. The code that most programmers write today is NOT the CPU intensive portion. Usually the CPU intensive portion is in the library called by the programmer: rendering a box, moving things around on a storage device, making something appear on a network.

    In these cases, a high or low level language makes no freaking difference on execution speed. However, your choice WILL make a huge difference on time to develop, maintainability, resultant bugginess, SECURITY, etc.

    OF COURSE THERE ARE EXCEPTIONS. Maybe you're writing a routine that needs to draw lines fast, or move bytes through a network filter at 100MB/sec, or you're compressing a file, whatever. In these cases you tend to write the performance critical code in a more low level language so you have greater control over the physical machine. Sometimes you write the entire application in the low level language.

    Many high level languages provide mechanisms for calling low-level code when it's necessary for performance. It's often pretty easy.

    The performance argument is a red herring.

    1. Re:What's with all of the bellyaching about speed? by good-n-nappy · · Score: 4, Interesting

      Maybe you're writing a routine that needs to draw lines fast

      This is one of the specific things you can't really do with JNI and Java anymore. Java graphics is now really complicated. There's no way you'll be able to use low level OS rendering methods and have them integrate with Java2D and Swing.

      It's actually a real problem. You've got no recourse when the graphics primitive you need is too slow. You end up with a Java workaround or you switch to OpenGL or DirectX, which don't have good support for fonts and strokes and such.

      This is where C# may end up beating Java, on Windows at least. Eclipse SWT has promise too since you at least have the potential implement your own graphics code.

      --
      Never underestimate the power of fiber.
  4. Try it before you knock it by nissin · · Score: 3, Interesting
    I've programmed extensively in C and Java, with some C++. I took a typical anti-Microsoft stance early on and refused to even look at C#. I was finally convinced to try it, and I must say that it has some nice features.

    I recommend that any programmers out there try using it before discounting it. It might be especially interesting for those C++ programmers out there who don't like Java for one reason or another.

  5. Re:Languages are not application-neutral by Waffle+Iron · · Score: 4, Interesting
    Comparing C, C++, and C# is like comparing a wrench and a screw driver.

    Moreover, languages like C and C++ can be used in very different ways, depending on the circumstances. You can code the "safe convenient" way using tools like STL or glib to manage strings, containers, etc. I've found that the overall performance of such an application often is in the same ballpark of a Java implementation (other than Java's obnoxious startup time).

    However, C and C++ also allow you to write in a "masochistic balls-to-the-wall" mode that gives you much higher performance in exchange for 10X the programming effort. To do this, you often have to analyze your algorithms over and over until you can implement them using only stack and static structures. You avoid malloc() at all costs, avoid copying any data unless absolutely necessary, etc. You might disassemble the compiler output, run profilers and arrange data in cache-friendly patterns to squeeze out even more performance. The implementation will be much more brittle and prone to bugs, but you can often get a 10X or more speed improvement over the "natural" C or C++ implementation. Obviously, very few problems warrant this kind of attention, but making blanket statements about "comparing" other languages to C/C++ really should acknowlege the large range of performance that these languages can cover.

  6. As someone who's developed in C#, C++, C, VB... by Anonymous Coward · · Score: 1, Interesting
    As someone who's developed in C#, C++, C, VB, and Java, I think this article makes a very good point. C# really isn't slow. Bytecode, when implemented properly, is just as fast as native code. (.NET programs can be compiled to native code on installation, thus negating the issue.)

    C# is to C/C++ like what C/C++ were to assembly. Yes, Assembly is faster then C/C++, but most of the time it's not worth the trouble. Likewise, for a lot of programming that people do today, squeezing out every last processor cycle isn't always worth it! C# offers some very convienent features compared to C/C++, yet at a minor, (and sometimes no,) performence hit.

    Simply put, the language you use depends on the intended use of your application. If you're writing a number-crunching app for a single CPU type, then there's no reason to use C#. Likewise, if you're writing an application that needs to be developed quickly and be highly reliable, yet doesn't need to save each CPU cycle, then C# may be a better choice.

    Personally, I think C# is great for Windows GUI programming where there is a lot of user interaction.

  7. Almost as good as Delphi by occamboy · · Score: 2, Interesting

    I've been coding for a million years: 6502 machine code all the way up to a recent foray into C#, and almost everything in between. Here's my take, for what it's worth. And, it's your chance to mod me down for pontificating!

    Delphi is the best all-around language ever for producing Windows apps. The Delphi programmer has control over everything if they want it, but they don't need to muck around with nasty details unless they need to. It encourages clean coding. Performance is superb. And the IDE is excellent. The Delphi package (language plus IDE) has been the path of least resistance to getting an app done for the past six or seven years.

    Prior to Delphi, the way to go was VB with C DLLs. Do the UI in VB, do the internals as C DLLs. VB was great for abstracting nasty stuff, but it often overabstracted, and performance was ungood. Writing companion DLLs in C boosted flexibility and performance.

    Generally speaking, C is basically not much beyond portable assembly language. If a reasonable alternative is available, and it usually is, using C for anything beyond embedded systems or super resource-critical applications is probably not a good idea, as the code tends to be dangerous and obsfuscated. And keeping track of pointers is just nutty.

    C++ is a nightmare. In theory it's object oriented, but all of the code that I've seen is a total mess, more like C using the C++ libraries. Ugh.

    Java is almost good: it is pretty safe, and encourages good habits. But I find it clumsy - like it was designed by academics rather than practical developers. Lack of enumerated types, for example, is insane, and encourages unsafe programming. It's also a pig, which doesn't matter so much for a lot of things these days - we usually have lots of CPU cycles to spare. For doing GUI apps, Swing is a weird joke - a pig's pig - which should be forgotten immediately. And the Java IDEs have only recently become usable for command-line stuff, but they suck as bad as Swing for GUI development.

    Now C#. Having toyed with C# for an app recently, I'm quite impressed. It's sort of like the best of Java with some of Delphi's goodness added. It's ALMOST as good as Delphi - which makes sense, since the same fellow (Anders Hejlsbeg) was key in developing both of these languages. And .NET, to which C# is bolted, is pretty good as well. And the IDE is very nice. So, all-in-all, I think that C# is a good choice for Windows development. The web forms stuff seems interesting, but I have a feeling that using it would be something that I'd end up regretting - there's bound to be nasty gotchas that won't show up until late in the project.

  8. ...and the .NET Framework is language-neutral by kylef · · Score: 5, Interesting
    What language you use depends on your application. Comparing C, C++, and C# is like comparing a wrench and a screw driver.

    And this is where the .NET Framework shines, because the CLR is a generic virtual machine to which any number of languages can be compiled. Currently there are C#, C++, VB, and even Java (under the moniker J#). There has been talk of writing a Python compiler and even possibly a Perl compiler. So you can choose your language of choice, and your resulting binaries or objects will fully interoperate with the other .NET languages and class libraries.

    And as far as this article is concerned, I think the interesting point is not that they're comparing apples to oranges, but just that the performance numbers for CLR-compiled C# aren't so horrible that they should scare off the majority of developers.

    1. Re:...and the .NET Framework is language-neutral by Daimaou · · Score: 2, Interesting

      You know, I used to think that the idea behind .NET supporting all these languages was interesting, but now that I've actually used it, I can't see what the big deal is; especially since the development environment to program for .NET is different for each of the different languages. Sure, you can hook a smattering of languages together, but who on Earth really does that? I have never worked for a company that says "write in whatever language you want to, we code to .NET so it doesn't matter!" What a nightmare that scenario would be. Most companies force standardization on one or two languages and then hire people with appropriate experience.

      What I find much more useful, and therefore of a much higher "cool" factor, is Borlands new C++BuilderX. Now that is a damn fine looking development tool. I can't wait to try it out.

      C++BuilderX allows a C++ or C developer to pick from several compilers (Borland, MS, GCC, Forte, etc.), it will compile to Windows, Linux and Solaris, and it supports the EXACT SAME development/debugging environment regardless of which combination of compiler/OS you choose. It also lets you seemlessly interface with a variety of version control systems. To me, that seems much more useful than having a bunch of different environments that will compile a bunch of different languages to one VM.

  9. #insert <obligatory_Java _generics_rant> by Anonymous+Brave+Guy · · Score: 4, Interesting
    Java SDK v1.5 (not yet released) contains support for 'generics', which are very much like C++ templates for Java:

    I really can't believe this thread. Why do people always come up with this worn out line whenever someone suggests that C++ templates are an advantage? And how come so many people have done so in replying to the same post? All but the first are (-1, Redundant), and the first is (-1, Ill-informed).

    OK, please, read this carefully, for I shall write it only once (in this thread):

    Java's generics are not even close to the power of C++ templates. They are glorified macros to fix a bug in the type system that should never have been there.

    C++ templates were at that level around a decade ago. Today, they're used not only to create generic containers (for which they are, no doubt, very useful) but also, via metaprogramming techniques, as the tool underlying most of the really powerful developments in C++ for the past few years: expression templates, high performance maths libraries, etc.

    If you didn't already know that, please read it again and understand it before proceeding.

    Java's generics don't even come close to the same power. They're a cheap knock-off, aimed at just one of the uses of C++ templates, which fixes a glaring flaw in the previous Java language. For that, they serve their purpose well, but please don't pretend they're anything more.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  10. Re:jump off the bandwagon by prowley · · Score: 3, Interesting
    I am not sure what server side applications you have been involved with but in my experience server side applications have LONG process lives. They are expected to be up 24 * 7, for as long as possible. Just as an example lets say Apache.
    Which just happens to not be written in Java... Server processes that do require to be up and running 24/7 are written in C (maybe C++) by people who know why. Servers written in Java for the 24/7 operation are written by people who read why in a magazine. Sorry, but I still cannot stifle a smile when Java and server are mentioned in the same sentence. I know there are many true-believers, but really, even if it does look good on paper, just wait til that garbage collector kicks in and I'll have yer 24/7 right here.
  11. Re:What is "good"? by hey! · · Score: 2, Interesting

    First of all, I've been at this professinally for over 20 years. C has always been considered to be a "low level" language -- even compared to something like Fortran. Fortran, in the versions most of us learned it when back whe it was more or less mandatory to learn it, was not "low level", it was just primitive, which is not the same thing at all.

    The big change over the years isn't just that machines have gotten faster: systems have become more complex. Typical application programs are more complex than entire operating systems used to be. It isn't just that Java and C# make programs cheaper, being cheaper is another way of saying more complex systems can be built for the same budget (python takes this to a further degree).

    Making real applications in the real world, I'd say this: performance doesn't matter until it does. At some point you'll deliver a product that is just not fast enough. Probably you screwed up; you should have reorganized this or that, but often its hell to fix. I always tell my guys that there is no difference in a user interface between 100ms and 300ms, not much differnce between 1 hour and 3 hours, but a lot of difference betwen 1 second and three seconds. In those cases a "frees" 2x speed improvement (which we've seen with some library upgrades) or even 20%, is a godsend.

    WRT databases, I'd say this: I'd pit a modern RDBMS against an old hierarchical database -- depending on the query. Machines have got a lot faster, it is true, but databases have also got much, much larger, and the questions we are asking them are a lot more complicated. With the old databases, pretty much every question required some kind of hand coded program to answer. With modern RDBMS's, unless the question is something that can be answered by a trivial algorithm (adding a single column or traversing a single index), there's little doubt in my mind that a modern optimizer will beat what most programmers would produce in the time available to them, and what many programmers could produce with unlimited time.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  12. Anyone played Quake II.Net? by Anonymous+Brave+Guy · · Score: 2, Interesting

    Microsoft have had a .Net version of Quake II mentioned on their developer pages for some time now. It's a port to Visual C++ .Net 2003, using the CLR.

    Has anyone tried this? It's presumably managed C++ rather than C#, but it should give a fair indication of the performance you'd get from C# if it's using the same run-time framework. If they can get comparable performance in a FPS using the .NET run-time, it might be worth looking at for games development after all...

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  13. Re:jump off the bandwagon by Anonymous+Brave+Guy · · Score: 3, Interesting

    Give or take a few quirks, most recent (last five years, say) C++ compilers support all the major features acceptably well for most purposes. There are only a few issues that cause significant problems: the infamous export, Koenig look-up and partial specialisation of templates come to mind. None of these features is used very often anyway, though.

    Coding standards that forbid the use of templates, exceptions and half the standard library in C++ are common, but way out of date.

    By the way, I write code for a living that gets shipped on more than a dozen different C++ platforms. Alas, some of them are well pre-standard, and so don't support even basic template or exception mechanics properly, which sucks. But this is an issue we've looked into in some detail, so I'm pretty confident in my statements above.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  14. Re:#insert by pyrrhonist · · Score: 2, Interesting
    Today, they're used not only to create generic containers (for which they are, no doubt, very useful) but also, via metaprogramming techniques, as the tool underlying most of the really powerful developments in C++ for the past few years: expression templates, high performance maths libraries, etc.

    Translation: Today they are used to butcher a perfectly fine language and add new impediments to understanding.

    --
    Show me on the doll where his noodly appendage touched you.
  15. Re:Again, you are speaking... by eloki · · Score: 2, Interesting

    But what if app A doesn't use but 1 function in library A? And, app B only uses 1 other function from library A?

    This is why Linux pages things in on demand. It doesn't read the whole library and load it into physical memory. The library is conceptually mapped into your address space, when you try to access a function foo(), if foo() is in a page that isn't currently loaded in physical RAM, the OS gets a page fault, and that page will be loaded.

    Just because you're linked against libc, that doesn't mean you're physically loading every string function into RAM when your program runs. The granularity you're talking about probably isn't worth the gain in extra complexity.

  16. Oracle by Un+pobre+guey · · Score: 3, Interesting
    So, with no loss of portability or functionality, you could do the same in C/C++.

    Try this:

    Write a backend app in Java, and one with the same functionality in C or C++. Make sure they both read and write data to an Oracle database. Now, with stopwatch in hand, make them both run on Win2K, Cygwin, Solaris, and Linux.

    Guess which language will allow you to finish first.

  17. Re:#insert by Anonymous Coward · · Score: 2, Interesting

    Correction: generics are unglorified macros. Templates are glorified macros. Templates can add type safety at compile time with no runtime penalty. Generics macro expand their type safety into java casts, which incur a decent runtime penalty (especially for large container intensive algorithms).

    Additionally, I once saw someone (saurik from saurik.com) use templates to do dynamic programming at compile time. He wrote an exponentially increasing algorithm to have an exponentially increasing compile time but constant run time when an arbitrary limiting value n was increased. Not actually useful, but still really damn clever and it illustrates the versatility of templates for meta-programming. And more importantly, I am pretty sure the same program is illegal for generics.

  18. Re:Whoa whoa whoa! by willtsmith · · Score: 2, Interesting

    I would suspect that brininging a "managed environment" to system level programming would be a good step.

    C/C++ have served us all well. However, I suspect that something a bit more portable and simpler may be relevant, especially with the byzantine complexity of C++ behavior.

    On the application end, I would suspect aspect-oriented programming is next on the horizon. More structures to ensure quality (pre/post conditions). More programming by definition and constraint with glue (built in quality control).

    --
    -------- -------- Support Wesley Clark for president!!!
  19. Re:#insert by pyrrho · · Score: 3, Interesting

    I posted this already... go see how blitz++ works.

    It doesn't make the language butchered in the least, quite the opposite, the end result is very clear to use and the confusing part is hidden inside the classes, where it cannot cause trouble.

    the thing about C++ is, sometimes things are hard, but the reason you do them anyway is because they are worth it, and you can get high levels of abstraction (arbitrarilly high) without taking runtime hits. You have the ability to control your overhead, templates are a great example, especially the examples the parent poster mentions, expression templates, and high performance math libraries.

    Blitz++ uses templates in an elegant, mind blowingly cool way. It might not be clear how it works to many, but that doesn't change how it works. Truly beautiful. And it makes the code easier to read, not harder.

    --

    -pyrrho

  20. Re:jump off the bandwagon by deanj · · Score: 3, Interesting

    Start up time should be a lot better in the 1.4.2 release. Last JavaOne they specifically said work was being done on that. Further improvements are in 1.5 (when it comes out).

  21. Bad Kool-Aid. by rjh · · Score: 4, Interesting

    Currently there are C#, C++, VB, and even Java

    If I understand the .NET framework correctly, there is no way to support either multiple inheritance or templates--in which case C++ cannot be accurately modeled in .NET. Nor will Java be .NETtable after 1.5, which will introduce pale imitations of templates (but imitation enough to give the CLR a hissyfit).

    The .NET CLR does not support multiple languages. It supports one language--C#. Its "multiple language support" comes from being able to compile down many functionally-identical languages with different syntaxes down to the same bytecodes.

    But truly different languages are not representable in the CLR. Show me how to do a Scheme continuation in the CLR, please, or export a C++ template, or a LISP macro.

    The only languages .NET supports are those which are subsets of C#. And once you realize that, .NET becomes much less interesting.

    (Warning: haven't used .NET much in the last few months. Last I checked these things were true, but after being very unimpressed with .NET I haven't kept up with things.)

    1. Re:Bad Kool-Aid. by gglaze · · Score: 3, Interesting

      How can this comment be (+5 Interesting) while each of the subsequent comments are 1's and 2's? When I first read this, I almost jumped to write a diatribe, and found that the other replies had already covered most of the important points very nicely. This comment should be marked (-1 : Ill-Informed) or some such rating, as it is highly misleading to anyone on /. who might be trying to learn about .NET.

      As the others have mentioned here, the CLR is an abstraction of the assembly instruction layer, not the "object-oriented" layer. Thus, a statement such as "CLR does not support {select archaic c++ OO concept}" does not make any sense. This obviously applies for things like multiple inheritance, templates, etc.

      Furthermore, the idea that the CLR "does not support multiple languages" is the most ridiculously malinformed statement I have ever heard about .NET, and trust me, I've heard plenty. One of the major objectives, if not the most important, is to bring to prime-time quality Microsoft's idea of supporting many languages on the same framework. They started this idea a long time ago with COM, and as it evolved, they realized all of the flaws in the COM architecture, and .NET is the next generation of multi-language support, in that sense. .NET currently supports what, like 20+ languages? Not all of them developed by MS, btw... Many of these languages use different paradigms (scripting-oriented, functional-oriented, procedural, etc.), and they all have access to the full breadth of the .NET framework. If that's not "multi-language support", I don't know what is.

      To assume that languages supported by .NET are "subsets of C#" is either naive or very malinformed. Anyone who knows the history of this knows that VB has always been Microsoft's baby, and C# is just the new kid on the block. Yes, now that C# has realized its potential, perhaps it is overtaking VB in popularity. But to claim that VB provides a "subset" of C#'s functionality is precisely backwards - in fact it is literally backwards - if anything, C# provides for the most part a subset of VB functionality, although technically the two provide somewhat intersecting but not fully overlapping sets of functionality - there are some things you can do in VB that you can't do in C#, and there are some you can do in C# that you can't do in VB. And the same goes for all languages on the .NET platform.

      Features like templates and multiple inheritance are first and foremost a feature of a language at the OO-level of abstraction - not the assembly level. As one poster noted here, Eiffel is a good example of a .NET language which already supports these concepts. If you wan't to complain that C# doesn't support them, that's ok. But to complain that "CLR doesn't support them" really doesn't make sense. Get your argument straight first.

    2. Re:Bad Kool-Aid. by mrdlinux · · Score: 2, Interesting

      As I hinted, without built-in support for higher-order functions and closures, a language cannot be considered to be `functional', because you would essentially have to implement these features yourself in your program (and most likely need to work around the limitations of that language also).

      Does attending a university make me an academic? I don't think so---I also work, and understand the practical viewpoint of a coder; I just don't see it as adequate justification for throwing away the dictionary. As it is, `functional programming' is also supposed to mean `no side effects' but that has now been relegated to `pure functional programming'.

      Personally, I backed away from the pure FP stance a long time ago, but I still think that higher-order functions and closures can be an extremely useful tool for any programmer and they can easily be mixed into other paradigms (just look at Smalltalk and Common Lisp).

      --
      Those who do not know the past are doomed to reimplement it, poorly.
  22. Re:You're missing something by pantherace · · Score: 2, Interesting
    Actually things like this have been done (re-optimizing compilers) for binary programs. Please note that this is not run-system optimization (as is the case for the c# compile on install, or something like gentoo) this is run-time optimization, which produces faster code. I know of experements on alphas (based on what fx!32 did (which is interpretive emulator+translator+run-time optimization (might be where more jits try to go, and may be considered a very early, and very very advanced jitc.) and in production (as I recall) on pa-risc. This is nice for all the byte-code languages with jit's but under those run-time optimiziation of the code, (and the ability to store it to disk permanantly, vs when the jit loads, or changes (admittedly may be never)) pretty much always found that the c and other binary generating languages would be faster in the beginning, and end.

    Essentially: all languages have a lot of maturation to go through, and more optimizing. :) Hell, I will be impressed when a language runs well on EPIC, with it's lack of hardware support for things most procs do in hardware, as a design idea.

    I look foreward to a reply.

  23. There's no performance overhead for a VM by cartman · · Score: 2, Interesting

    I've done significant work in benchmarking Java programs versus equivalent C/C++ programs. I've found that garbage collection is the sole reason that Java is slower than C++; having a "virtual machine" imposes no performance penalty whatsoever. This is unsurprising, when you think about it; a JIT compiler simply moves the latter phases of compilation ("byte code->assembly") to runtime.

    Contary to what many people think, even most traditional C compilers work by compiling source to byte code, optimizing the byte code, then compiling byte code to assembly. There's no reason to expect that the resultant assembly will be any slower just because the final phase is done at run time by a JIT.

    Programs compiled using IBM's Java compiler routinely outperform equivalent programs compiled using "gcc -02", if garbage collection is not used in the Java program being compiled.

  24. Re:You're missing something by Anonymous+Brave+Guy · · Score: 2, Interesting

    I agree completely: a lot of it is down to the maturity of optimisation technology for the language in question. This is part of the reason that some high level languages -- OCaml, for example -- can generate code of a comparable speed to low-level beasts like C and C++: with a simpler underlying model, it's easier to perform good optimisations. It's also the reason C is still faster than C++ for some things, even though theoretically, C++ should never be slower.

    I was including dynamic optimisation (during the program run) within the "late optimisation" idea, but in practice, I get the impression it's not used much yet. It's far easier to do platform-specific optimisation on installation or loading, effectively, just doing the optimisation phase of a compile late. Effective dynamic optimisation is a very hard thing to do, because you have the overheads of monitoring code speed to overcome before you can even hold your own, never mind gain an advantage. I suspect that in time, dynamically optimising run-times will gain a much stronger foothold in the market, but probably not until a lot more research has been done.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  25. Re:-1: Ill-Informed by rjh · · Score: 3, Interesting

    First, I'll ask you to please see my comments in the other response to you...

    Done.

    In fact, even his "brilliant" graph algorithms may have been top-class during his time.

    As far as I can see, remember, or am concerned, Dijkstra's contributions to computational graph theory are fundamental to the field. If you think they're brilliant-in-quotation-marks, all I can ask is what you've discovered that's comparable.

    That's not meant as an insult or a challenge, incidentally. It's meant to say that in hindsight many things become obvious which required real genius to see them in the first place. Dijkstra's graph algorithms are simple and straightforward, and in hindsight they're obvious--but let's not forget that the only reason they're obvious to us is because Dijkstra had the insight to see, in foresight, what's obvious in hindsight.

    If in your academic mind you truly believe this,

    You keep on calling me that, an "academic". The reality is I'm nothing of the sort except in the sense that I'm a graduate student. I'm a hacker, not an ivory-tower academic. I believe in solving problems and sharing those solutions with the world.

    It's axiomatic that if you're faced with a problem, one of the worst things you can do is stubbornly insist that it be solved with X technique. You have to show some flexibility. You have to be able to approach the problem from different angles. For GUIs, I've found object orientation is almost always best. For scientific programming, I've found template metaprogramming best. For using computers in math theory courses, I use LISP or ML. For writing system-level software, I use C++. Etcetera.

    My insistence on multiple paradigms is unequivocally not born out of "academia", a word which it seems you're using as an insult. My insistence on multiple paradigms is born out of my demand that I use the right tool for the job. .NET claims it will support all programming languages. It doesn't. It doesn't even come close. Once you realize .NET is just another VM that can be more easily targeted by compilers, you realize that "hey, this is ... really ... not all that interesting or useful," as I said in the post which kicked all this off.

    Why is it not all that interesting or useful? Because we already have that with Java. We've got a virtual machine which provides managed services and is targeted by over 60 different languages, all of which can use all the facilities of the other languages once their code has been reduced down to bytecodes. We've got a VM which allows you to interface with the native hardware to get a massive speed boost.

    Am I talking about .NET or am I talking about Java? In this case, Java. (I can't confirm the 60+ languages bit, but that's the number I see. Last I heard, Java supported more languages than .NET, but this gap was rapidly closing and the numbers are a couple of months old.)

    So where is .NET interesting? It was interesting the first time Sun did it with Java. (Or, for us dinosaurs, it was interesting the first time I saw UCSD Pascal do it with their VM.) It's not interesting this second time around.

    Where is .NET useful? If you're married to the Microsoft platform, then I guess it's useful. But really, where's the huge win for .NET over Java? There isn't one. It's an alternative to Java, not really something new and innovative, not something which allows you to solve more problems than Java or even allows you to solve them all that much differently.

    That said, is it useful for Company A, which prefers VB, and Company B, which uses Java, to be able to collaborate on software, each using their preferred language, with their results able to be executed on a shared VM?

    Sure it is. That's not what I mean when I say ".NET is neither useful nor intere

  26. Re:-1: Ill-Informed by rjh · · Score: 2, Interesting

    if you have some kind of auto-email thing turned on let me know, because I'm a relative /. newbie and have no idea how to set that up if it exists...

    Check your User Page.

    You'll see a dropdown box saying "Comment Reply". Select "Email", then save your changes and you're done.

    That said, I hope you enjoyed that act of friendliness, because I see nothing but disagreements in the near future. :)

    What I really wanted to point out was the fallacy of the "language worth learning" quote, in that it only uses "worth" in once sense of value, when in fact the majority of people in the world who deal with technology use a completely different set of criteria on which to place the "value" of learning a language - and this usually comes down to $ in the end.

    I'm utterly unconvinced that the software industry has any sensible valuation of worth, particularly in the management field. Paul Graham has a great essay on why this is--what it boils down to is management's knowledge of the field and languages is primarily imparted by marketing glossies and marketing departments (either Sun's or Microsoft's, it appears). Hackers' knowledge of the field is primarily imparted by catastrophic disasters.

    As an example of this, Java is being used in a lot of places today where it really shouldn't be. In 2000 during the height of the Java hype, a friend of mine who worked for a major United States bank was driven up the wall by a management decision to migrate all their COBOL apps to Java. "After all," Management said, "COBOL is a dead language and these are fifty-year-old legacy programs."

    To a hacker, COBOL may well be a dead language, but a program that has a fifty-year record of reliability basically swaggers around the RAID array menacing newer programs with <DenisLeary>"yeah, I may be written in COBOL, but I haven't crashed in fifty fucking years, guy, okay?"</DenisLeary>

    So was this major U.S. bank wise in their decision to migrate all their legacy COBOL apps to Java? By your logic, yes, because industry knows the value of software and can properly evaluate things in a dollars-and-cents manner. I'm certain there was a great business case made for this mass migration. I can't imagine what else could make a bank decide to undertake something that risky.

    And after about 150 man-years of work--optimistically, about $15 million of development--the program was abruptly cancelled due to the fabled dollars and cents failing to materialize.

    Wherever you look in the industry there are all sorts of examples like this. In the commercial software industry, I've seen far more projects fail than succeed. How does the industry respond to this? By declaring any software project that comes in at under 500% cost overrun and a year late to be a "qualified success".

    The thing is, we all know this. We've all read The Mythical Man-Month. Most of us--I imagine you do, I know I do--have horror stories about death marches and the Project That Would Not Die And Yet Never Truly Lived, Either.

    Given the spectacularly poor state of software management nowadays, I'm deeply skeptical of any claims that the software industry is in a position to make accurate estimations of value, whether that value be in a financial or a technical sense.

    I'm a hacker. I don't know about how to value software in a financial sense. (I'm heartened by the fact that nobody else does, either.) On the other hand, I do know how to value software in a technical and artistic sense. My estimations will differ from the next hacker's, but in general we can make certain agreements--that COBOL is crufty but COBOL legacy apps that run for fifty years rock, that LISP is woefully underused, that people keep on using C when they really want to be using something else, etc.

    if they had the same skillset level and also the same level of mathema