6 ms·
>it's very portable Mono, I'm guessing you mean. Mono's not great for server applications, it's best used for desktop apps. If you want to write server apps, y
by codewright 14y ago
>it's very portable
Mono, I'm guessing you mean. Mono's not great for server applications, it's best used for desktop apps. If you want to write server apps, you need to be using the official Microsoft implementation. (Which is becoming the red-headed stepchild platform in Microsoft's strategy apparently?)
> Second, performance is as good or better than pretty much anything else that is not optimized C or C++
Lets find out:
http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php http://shootout.alioth.debian.org/u64q/which-programs-are-fa...
List of things that are faster than C#:
Fortran, Ada C, C++, ATS, Java, Scala, Common Lisp (SBCL), and Go.
List of things that aren't faster than C#, but are close enough to call it a wash:
Haskell, Ocaml, Clojure, Pascal, Racket
I'd say you have some choices if performance is an issue yet C#'s is acceptable.
>It's a very beautiful language, much nicer than Java used to be
No, yes. It's nicer than Java, it's not "very beautiful". Try working through the Little Schemer to see a beautiful language.
>And innovation continues: If you've worked with node.js for some time, you will see how ugly code becomes where everything is done using callbacks.
Bizarre strawman? What? I don't like Node.js either, but what's your point? A lot of languages that aren't C# have better concurrency idioms than Node. You know, like all of them that aren't C#.
> C# just now introduced new syntax where you can basically write code in a linear way and the nesting of callbacks is done by the compiler.
Yeah, uh, Scala has had this since forever. And Lisp. And Scheme. And Clojure. And C++. And Node.js (ugh).
For a C++ example, look at Tame/Tamer, SFSLite, etc.
For anything else, google "promises".
There is nil that is special about C#, it's a slightly nicer Java without a home or a stable implementation. If neither of those things matter to you and you wanted a Java++ that wasn't as ambitious or intellectually challenging as Scala, then you've found your language. Godspeed.
- throwAway7936 14y agoMono certainly works on the server. Your comment just tries to derail the discussion by bringing up Scheme or Lisp in a context where only languages are considered that are widely used in the industry. Otherwise, how could the word "abandon" possibly apply? This language shootout has been criticized before. Except for optimized C and C++ there is no popular language (I'm talking about the performance that is due to the design of the language, _not_ a particular implementation. For example dynamic typing is necessarily slower.) that is faster than C#. Try unsafe C# and you know what I mean. Bringing up Scheme here is entirely inappropriate. It's common wisdom that Lisp and Scheme are more beautiful, but this article is about a language that is supposedly "abandoned", because it may not be mainstream enough anymore at some point. If C# is abandoned, then what can you say about Scheme? As far as node.js is concerned, it's not a strawman: In fact, the people who claim that MS abandoned C# think that they want to replace it by Javascript. MS even supports node.js in Azure. "concurrency" is not the same as asynchronicity, which is what I was talking about. And promises are not even close what C# 5.0 tries to achieve. In fact, promises have been present since .NET 4.0. Finally, please explain how Scala is "intellectually challenging". This is not my experience. (throwaway account due to procrastination setting)
- igouy 14y ago>> This language shootout has been criticized before. << Criticism can be uninformed, out-of-date, self-serving, mistaken... ;-)
- snogglethorpe 14y ago> Except for optimized C and C++ there is no popular language (I'm talking about the performance that is due to the design of the language, _not_ a particular implementation. For example dynamic typing is necessarily slower.) that is faster than C#. Er, but you can't just completely disregard implementation, because it really matters in practice. You're not going to get a lot of adoption simply because your language is theoretically better/faster/... In these language shootouts, Lua, a dynamically-typed language aimed at small size and simplicity, regularly beats out C#, because Lua has LuaJIT[+], which is a really good implementation, whereas C# for many people means Mono, which is at best an "OK" implementation. It's the same as with algorithms: big-O complexity is obviously important, but it isn't everything; for real-world uses, the constant factors may make all the difference... [+] The standard Lua implementation is also very good, but it's a more typical VM, and while very fast for a non-JIT VM, can't match LuaJIT in many cases.
- skrebbel 14y agoYour post is full of FUD, taste mixed with fact, and little incorrectnesses. Most notably, your post seems to imply that for C# to be worth something, it has to be the best at something. Yet, Scheme is a prettier language (taste, not fact), a whole bunch of languages already had continuations, a whole bunch of other languages are faster, and so on. C# is great because it's above-average good at all of these areas. C# has one of the best standard libraries out there (well documented, rather well designed, batteries-included, etc) C# has a decent set of relatively modern language constructs, yet is easy enough to learn for a very large group of programmers. C# is faster than most (but not all) languages sporting a comparable set of high-level features. C# has excellent tool support, and was designed for enabling such tool support, making refactoring and code navigating easier than in any other language except Java. C# has a large ecosystem and user-base, making it easy to find answers to problems and components that solve problems not covered by its standard library. None of these items, in isolation, are special. Java arguably has a stronger ecosystem, but is a less powerful language. C++ is faster, Scheme is more elegant (according to many), and so on. But I know of no other language that has all these areas covered so well simultaneously. Scala comes close, but is arguably more difficult to learn, and lacks on the ecosystem area (not in terms of library support, but in terms of best practices and large user base). This might change, which would be lovely. All other languages you mentioned strongly lack on at least one of the above-mentioned aspects. I'm not saying that C# is god's gift to mankind and the only good thing out there. I'm only saying that you're dismissing it too easily. There are sufficient people out there who really like this combination of features to support a vibrant open source community. Which is why this community exists. Why dismiss something that exists and works well?
- pdubs 14y agoI know you mention tool support I think it's worth mentioning that if you're using the MS stack Visual Studio is really, really good.
- skrebbel 14y agoIt is, unless you come from Java (using IDEs like NetBeans or Eclipse), in which case it's kind of comparable (but different). IMHO. In fact, if MS were ever to make .NET/C# legacy like some people seem to believe "WinRT allows horribly HTML5 apps" implies, I bet JetBrains would just bolt ReSharper onto IDEA and off we all go.
- jules 14y agoIn addition to skrebbel's excellent points, C# on the CLR is faster than Mono, and C# supports value types so in real world code that often gives it an advantage over Java. For example a List<int> in C# is a tightly packed array of integers, in Java it's a list of pointers to integers. In Java, you can in theory rewrite each collection class (hash map, hash set, tree map, tree set, list, etc.) for all primitive types (and pairs, and triples, etc. of primitive types), or write everything directly on top of primitive arrays (as is done on the shootout). In the real world for most code that's not practical and leads to unreadable/unmaintainable code.
- igouy 14y ago>> or write everything directly on top of primitive arrays (as is done on the shootout) << Please tell us specifically which Java programs in the benchmarks game, you say, are written directly on top of primitive arrays.
- jules 14y agoBasically all the programs that use collections at all? Of the first 7 programs that I checked, 6 use primitive arrays, and N-body uses an array but that array contains a pointer type. Fannkuch-redux, meteor contest, fasta, spectral-norm, reverse complement, mandelbrot ... all use primitive arrays. A better question would be: which programs do NOT use primitive arrays? I'm not saying that these should be written using ArrayList or something, just that they are not very indicative of real world performance when people are more likely to use the collection classes.
- devb0x 14y agoScala easily can become unreadable. c# is easy to learn, easy to implement, and easy to handover, to a team, a junior etc. It is easy to wrap up dev of an application in .net. Super easy. I've done some awesome things in c#, and love the language. Why, cause when it is easy to ship working software, what's better than that.
- igouy 14y agoShouldn't you extend that "close enough to call it a wash" on the "faster" side as-well-as on the "slower" side? So add "ATS, Java, Scala, Lisp, Go" to "a wash" and we're left with "Fortran, Ada, C, C++" as "faster".
- malkia 14y agoTo be fair the shootout uses open source language implementations and runtimes. It could be that .NET is more performant than Mono (which is used in the tests), so that's not very objective view of what is possible with a C# implementation.
- igouy 14y agohttp://shootout.alioth.debian.org/demo/compare.php?lang=csc http://shootout.alioth.debian.org/demo/compare.php?lang=csc It is a "very objective view of what is possible" now on Ubuntu.
- migueldeicaza 14y agoLanguage Shootout does not use Mono configured for HPC (--llvm, -O=unsafe). It will also likely do poorly, because LLVM is slow to startup, but the resulting code is nothing short of God's own fine tuned code. Alternatively, you can pre-compile the code with AOT: mono --aot --llvm -O=unsafe sample.exe But AOT code requires the sacrifice of a register to the gods of position independent code. Kind of the same perf hit you get from gcc -fPIC foo.c
- igouy 14y agoHere's the command line for the spectral-norm C# programs shown on the benchmarks game website: /usr/local/src/mono-2.11.4/bin/mono --gc=sgen --llvm spectralnorm.csharp-2.csharp_run 5500 As you can see --llvm is used. (Since June 27, 2012)
- migueldeicaza 14y agoLovely! This sample shows the startup cost of LLVM. It is not ideal for short-running tasks, as just JITing this code with LLVM increases the overhead for this test by 0.42 seconds on my machine (iMac, 2010). Might be worth running this for a longer period of time, they will basically converge. LLVM is great for HPC, when this startup cost is not a problem.
- igouy 14y agoSadly not lovely, because when I installed Mono 2.11.4 a couple of weeks ago, I forgot about "Compiling with stock LLVM is not supported, please use the Mono LLVM repo..."; and I guess when --llvm is used without LLVM being enabled, Mono does not give a warning message. The Mono 3.0.0 measurements are made with LLVM enabled.
- migueldeicaza 14y agoIt does not seem like you understood the original poster, hence your set of incorrect statements that ends with "And C++. And Node.js". Let me help you. He is talking about C# async, you can read more about it here: http://msdn.microsoft.com/en-us/library/hh156513.aspx http://msdn.microsoft.com/en-us/library/hh156513.aspx
- codewright 14y agoLet me help you. https://github.com/okws/sfslite https://github.com/okws/sfslite http://www.read.cs.ucla.edu/tamer/ http://www.read.cs.ucla.edu/tamer/ http://stackoverflow.com/questions/5579602/what-is-the-scala-equivalent-of-fs-async-workflows http://stackoverflow.com/questions/5579602/what-is-the-scala... You will note that it's a comparison between F# and Scala. http://dispatch.databinder.net/Dispatch.html http://dispatch.databinder.net/Dispatch.html The standard HTTP client of choice is async, although the simple API wouldn't necessarily tell you as much. https://github.com/ztellman/lamina https://github.com/ztellman/lamina From the clojure people. Agents bear mentioning too.
- migueldeicaza 14y agoIt looks like Tame is a pre-processo that outputs C++, hardly a C++ language feature. I mean, more power to you if you like to use those, but that is hardly C++. The Scala question seems to have too many caveats, you should read the comments as there is no full translation of the F# async translation in the stackoverflow question. The answer with the most question states "with some important features lost". The comments on the question and answers should be read as well. Cute Http Stack though. The lamina code runs the code on a separate thread (https://github.com/ztellman/lamina/wiki/Introduction https://github.com/ztellman/lamina/wiki/Introduction) hardly what C#'s async does. Not that I care that much, but that is what the docs say. You forgot to show us how Node.js is supposed to support async-like programming without callbacks. I suspect in a rush to enumerate a bunch of languages, you merely listed everything you could think of and hoped some of it would stick?
- codewright 14y ago
- migueldeicaza 14y agoIt does not seem like you understood the original poster, hence your set of incorrect statements that ends with "And C++. And Node.js". Let me help you. He is talking about C# async, you can read more about it here: http://msdn.microsoft.com/en-us/library/hh156513.aspx http://msdn.microsoft.com/en-us/library/hh156513.aspx