7 ms·
Fascinating, especially in the light of the Google Java issues right now- the performance graphs are just the icing on the cake. Mono has traditionally had a r
by untog 15y ago
Fascinating, especially in the light of the Google Java issues right now- the performance graphs are just the icing on the cake.
Mono has traditionally had a reputation as being a lot slower than .NET- perhaps that isn't the case any more either? It would be great to see some independent third party figures on this.
It's funny that the MS created C# is one of very few languages that lets you make native apps in iOS, Android and WP.
- gravitronic 15y agoI've been successful in using C++ (with libSDL) to write apps for Android, iOS, QNX (PlayBook) and WebOS (RIP). Whats more bizarre is that windows phone 7 does not have a development kit for using C/C++. Only C#/XNA. I've heard on HN that this may change for WP8. I hope so.
- HardyLeung 15y agoWP8 and Windows 8 are definitely very C++ friendly. I actually think that C++ may be the language to rule them all as the next generation of web application goes beyond what Javascript can handle. Well, that and C# given Miguel's effort. I can develop ONE piece of core logic, and have it run on iOS, Android, Windows, Mac, even web (via NativeClient). I posted an AskHN about this earlier today (though not much interest). That sounds like a win.
- bratsche 15y agoInterestingly enough, you can also run C# on NativeClient via Mono.
- cageface 15y agoIt's ironic, but C++ does seem to be the best language to write portable code in right now. C is just too low level and everything else is either too slow or tied to one platform.
- cantankerous 15y agoI was about to say "Java!!!" then realized how misplaced that statement was given the circumstances. Oracle really is shooting themselves in the foot here.
- Tloewald 15y agoHow much does Oracle care about Java as a language or platform? I think they want to sue Google, and the effect on Java is a non issue.
- zobzu 15y agoBleh, C++ sux to code for =/ I like C# although mono always failed to be nearly as good as .NET and that hindered C# a lot. If microsoft had realized it and made .NET multiplaform as well, and open source, we may live in a different world today. Heck, Microsft could be leading. But then again, rewritting the past is easier said than done.
- malkia 15y agoI don't get much of what you are saying here.. Any examples? Why would C code be less portable than C++? What C++ brings there that is more portable than C? I would expect the opposite - some runtimes do not allow exceptions, RTTI, dynamic_casting, or simply ABI interworkings due to name mangling and calling conventions for methods. Also virtual inhertiance and it's interworkings (where the this pointer is stored, and how multiple virtual ihneritance is done).
- cageface 15y agoFor example: I currently develop my own musical software instruments. This requires a lot of custom DSP code that has to be fast and portable. My only real choice here is C/C++. C is definitely even more portable than C++ but it's too low level (IMO) for application development.
- malkia 15y agoI'm sorry cageface. I've re-read it again, and I appologize.
- ConstantineXVI 15y agoNo details on WP8 are out yet, correct? I've heard from the rumor mill that it'll be derived from Win8, but nothing confirmed at all about the SDK.
- HardyLeung 15y agoYou are right that details are not out. What I said was purely conjecture on the part of WP8. However, given the roadmap, rumors, hints, discussions, the kind of people in charge (Sinofsky, known .Net hater), etc... I am pretty sure that WP8 will be like W8 in many regard. There were already some rumors (+ non-denial from MS) that WP8 may not run WP7.5 code so this seems a strong indication that it will be more like W8. And that's not a bad thing. I love C#/.Net (one of my projects, Tagxedo, was built with Silverlight), but given Microsoft doesn't have even the slightess will to push it, we may as well move on, or find some way to ride Mono. C++ is currently on my mind since it covers all ground (sans UI, which you still have to do anyway), probably in a way more straight-forward than Mono.
- randomfool 15y agoLack of C++ code is a significant limitation for high end mobile games- both from performance and porting costs. MS absolutely knows this (and hears it regularly from game dev houses). Dunno if it'll be solved in WP8, but they have something in the works. Derived from Win8 != WinRT- could just be the kernel and not app model.
- pcwalton 15y agoNative Client is only enabled for the Chrome Web Store at the moment. But you could use Emscripten.
- yread 15y agoSome of the more high profile apps on WP7 have huge native blobs in them. So if youre important enough MS might choose to share their toolkit
- cageface 15y agoHow do you bootstrap an SDL app on iOS? I've been considering taking this route myself because I really hate multi-language development and all my DSP code is in C++.
- HardyLeung 15y agoYour objective C code in iOS can directly call your C++ code. Your C++ code just need to be renamed with extension .mm.
- cageface 15y agoYeah this is how I use my C++ code on iOS now. I'm more interested in exactly what you do to bootstrap a C++/SDL app from nothing. I guess Armin Ronacher's blog post here makes a pretty good introduction: http://immersedcode.org/2011/4/25/sdl-on-ios/ http://immersedcode.org/2011/4/25/sdl-on-ios/
- jlawer 15y agoWell microsoft didn't make C# cross platform, that was all really the mono guys.
- aespinoza 15y agoYou are right, but it is still funny though.
- moonchrome 15y agoBut they made it an open standard (and are regularly updating it), which goes against the general perception of "M$".
- saurik 15y agoBack when .NET was still in beta, I was flown up to Redmond to provide some feedback on Managed C++. I specifically asked them why their Socket API was "crippled" in comparison to WinSock (which has some really beautiful mechanisms for handling things like cross-protocol addressing), and the answer I got was "portability to non-Windows systems".
- bad_user 15y agoOn the other hand the asynchronous parts of the Socket API was modeled after the Windows kernel, which has true support for asynchronous sockets. That's one reason why the Mono implementation was always suboptimal, because implementing that API on top of poll, epoll, kqueue and the like is not really straightforward. It's also the reason for why the attempts to build alternative web servers are using bindings straight to libevent, bypassing the socket API. The original plan was indeed for .NET to be portable to non-Windows platforms, but Windows-specific details have leaked in nonetheless.
- MichaelGG 15y agoNot to detract from the Mono team's awesome achievements but: - Microsoft has released a cross-platform CLR ("Rotor"). Win/Mac/BSD I believe. - C# and the CLR are ECMA specifications. - A lot of the class libs are definitely not Windows only. - Microsoft also has Silverlight (CLR) running on Mac, if that counts. The whole .NET stack, apart from some Windows specific libraries (some COM+ management stuff, Win Forms) were definitely made to be cross-platform.
- acak 15y agoForgive my ignorance. Which application lets you write native iOS apps in C#? Thanks.
- d503 15y agoMonoTouch http://xamarin.com/monotouch http://xamarin.com/monotouch
- untog 15y agoThe guys who made this blog post make some software called MonoTouch. http://xamarin.com/ http://xamarin.com/ It costs $400 for a license, though. But boy I am tempted... I know, I know- you need to go with the native languages for the best experience. But keeping a huge chunk of my codebase between platforms is a very, very interesting idea to me.
- stouset 15y agoA very interesting idea to you, but one your users couldn't care less about. Never forget about the users.
- untog 15y agoIt would be an interesting idea to them if they have an Android phone and I wouldn't have the time to code for two platforms otherwise. I get that there is a tradeoff involved, but the Mono-x products are in an interesting space. They aren't webviews (like PhoneGap), they aren't a weird JS hybrid (like Titanium)- they're full native experiences. You'll get some newly released features later (I imagine), but the user experience really shouldn't be affected that much.
- cageface 15y agoThe Mono guys have been very quick to support new iOS features so far.
- josephcooney 15y ago
- rabbitfang 15y agoRegular Java is currently faster (up to 3x) than C# on mono: http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=csharp&lang2=java http://shootout.alioth.debian.org/u64q/benchmark.php?test=al... ...but obviously on a phone it's going to be Dalvik not regular JVM We need to consider memory consumption too. Dalvik obviously uses less memory than regular JVM, and probably less than mono if I were to guess.
- raverbashing 15y agoI'm guessing the JVMs have gone a long way on optimization (or maybe they're using JIT) Also not sure about how optimized are the C# sources in relation to the Java sources For example, in the Mandelbrot benchmark there are several differences - Java uses more arrays - C# and Java use different break conditions - Calculations are done differently (with similar results) Overall they're doing the same things, the C# is more like I remember it, so I'm guessing the Java code has some smart tricks up its sleeve
- jeswin 15y agoWell, don't read too much into it. Here is the Java source for binary-trees, which is 6x faster than c#. http://shootout.alioth.debian.org/u64q/program.php?test=binarytrees&lang=java&id=1 http://shootout.alioth.debian.org/u64q/program.php?test=bina... C#: http://shootout.alioth.debian.org/u64q/program.php?test=binarytrees&lang=csharp&id=2 http://shootout.alioth.debian.org/u64q/program.php?test=bina... Notice that the Java code multi-threaded, while the C# version is single-threaded. And the Q6600 being used there has 4 cores.
- igouy 15y agoNotice that there's another Java program which is single-threaded but still uses more than one-core (figure out why) - http://shootout.alioth.debian.org/u64q/program.php?test=binarytrees&lang=java&id=2 http://shootout.alioth.debian.org/u64q/program.php?test=bina...
- migueldeicaza 15y agoSome observations: In general, HotSpot is a more advanced VM that Mono is. They support dynamic recompilation at a higher optimization level, which we do not. This is part of the debate in Google vs Oracle. Google could have used HotSpot had they figured out some agreement, but instead ended up with Dalvik which lacks many of the advanced optimizations of HotSpot. That said, java -server compared against out of the box Mono 2.10.8 is not an apple's to apple's comparison, it is by no means "regular Java". That is Java tuned with some specific parameters. It comes at the expense of interactive time, Mono's default is fast-JIT, and fast startup. Java -server uses a fixed heap, this means that you must preallocate how much memory the application will use during its entire lifetime. This is good for performance because the GC knows that it only has to scan for example memory between points A and B. 2 comparisons is all you need during GC to scan. Meanwhile, Mono is uses a dynamic heap, which means that it can grow its memory usage based on demand (no need to fine tune the maximum heap every time your app crashes due to a low setting) and can return the released memory to the OS. This complicates GC, because now we cant just compare against 2 values, we need to consider every object in the scope of a series of differently sized heaps. With Mono 2.11, you can force your app to go fixed heap; The only people that really have a use for this are HPC people and a handful of server people. To be honest, most people dont want to configure the max heap of their server apps by crashing and trial and error. The second component is that Mono's default is aimed for desktop/mobile configurations, not server loads. If you want to use server loads, run Mono with the --llvm flag: you will have very slow startup times, but you will get code quality that is essentially the same code quality that you get from an optimizing C compiler nowadays. As for Mono vs Dalvik memory use, in practice people run Mono with Dalvik (Mono for Android), not in standalone mode, so we end up paying for Dalvik's memory footprint. But I agree, it would be nice to find out how much memory it actually uses. Considering that we get the benefits of a more advanced GC, value types and generics while Java does not, it just seems like we would use less memory for comparable loads.
- saurik 15y agoNo one has made this specific point yet, which I've found surprising: it does not matter whether Mono is faster than .NET, it only matters whether Mono is faster than Dalvik.
- azakai 15y agoNot necessarily. High-performance apps on Android are written in C++ and RenderScript anyhow, not Java/Dalvik.
- shadowmint 15y agoMissing the point: you can write a blazingly fast android app in c++ with opengl; but it cant do anything useful because it can't use ui components, and will be stuck with sucky custom in-game ui components which, I think it's fair to say, are universally terrible (the QT port being the one exception to this). If you can in _any way_ achieve a method of using the existing android ui components and making them faster, this is a massive win.
- cageface 15y agoActually the trend on both mobile platforms seems to be away from stock components to either heavily re-skinned components or completely bespoke components. Games in particular tend to go their own way on this, probably partly because they need to be x-platform. Games (and often multimedia creation apps) have been rolling their own UI for a long time.
- potatolicious 15y agoI think you still miss his point - games have been rolling their UIs out of necessity for a long time, in large part because in most OSes (mobile or otherwise) native UI widgets simply do not mix with a big real-time rendered DirectX/OpenGL surface. So games have always been the fastest, most optimized performers on any platform. This isn't about games though - this is about regular ol' apps, many of which are incredibly slow and could really use the 8x performance improvement that these folks have been able to achieve. As a mobile dev myself, I don't think mobile platforms are moving away from Obj-C or Java. Sure, we have a lot of custom-built widgets to overcome shortcomings in what Google/Apple provides, but ultimately they're subject to the same performance limitations that plague the stock widgets. Nobody out there is digging into low-level OpenGL optimizations to write a custom navigation bar, for example.
- jurre 15y agoLately I've been thinking that Haskell might be a really good language to write cross platform native apps in. It's super fast but also high level so you can be really productive. I know there are some libs for iOS but if some sort of cross platform framework existed I think it could be really powerful.