Java vs C#
2:25
Added: 4 years ago
From: ivatanako
Views: 37,807
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (293)

Sign In or Sign Up now to post a comment!
  • What the hell is this?

  • well

    C# is faster then Java, 'cause it has no JVM=)

  • @DanIsHere91 well, C# has the CLR which in turn is the JVM equivalent of .NET.

  • Thread.sleep(60000)?

  • This vid is popular on Georgetown

  • Try writing 8086 Assembly for the best proformance times....

  • the only way to get more out of java is to break the poop paradigm, use a lot of static types and use more native calls. too bad they made it so damn hard to interop with c/c++/asm library and system calls. c# makes it much easier to do this. taking away pointers was supposed to make it easier for noobs but they just found other ways to f up the java code (read spaghetti frameworks more complicated than they need to be)

  • I work with Regular Expressions and C# and never saw a program running so slow. Can you please post the code you've used?

  • @marciopmm Console.WriteLine("AAAAGTAAAGA­C at 12800500 it took 15 mileseconds.", n);

  • Ehy ehy, lol sleep() ?

  • it doesn't look strange it looks staged .. if its not staged then you have no clue how to use .net or C# LOL...

  • Выложи исходники. Что-то очень странно выглядят результаты.

    Show us the source codes. It looks very strange.

  • This coming from a Java fanboy, if your Java code runs faster than your C# code, you're doing it wrong.

  • @HardCoreProgrammer1 STFU, You have no idea what you are talking about.

  • C # has always been faster than java code. not necessary the JVM.

  • long live the Cs C/C++/C#

  • weak

  • I bet he used the sleep command for the C# part......

  • System.Threading.Sleep(...)? seriously? grow up

  • lies, nigga

  • este video es una farsa

  • Comment removed

  • manageability(.)org/blog/archi­ve/20030520%23p_the_problem_wi­th_cameron <- c# regex class is instantiated with the regex.option compiled flag.

    it's into a loop so the compiler will compile that code to assembly for faster code, compiling takes time and resources though. without that option c# code is faster than java.

  • @Dataacid replace (.) with .

  • Wow, Java is fast! Are you using Java 6, err. Java 1.6, sorry, J2SE 1.6, err. was it Java 6 Update 22, or Update 25? I don't know it keeps asking me to update every day! Also your demo is wrong, technically you're comparing Java to .NET (C# isn't the runtime). BTW, congratulations on the newest feature in your favoured language. Strings in switch cases, not bad.. That brings Java 1.7 language features on par with .NET 2.0, hmm.. type erased generics? maybe .NET 1.1. /trolling

  • @jf03cg the guy who wrote that program was instantiating the regex class wrong. when did correctly program works like a charm. check my above answer to the video

  • i dont really care about speed. what matters is what you can actually do in it.

  • don't use winbugs

  • I just wasted 2 minutes of life I'll never get back :(

  • C# has got asp.net... most jobs are in asp.net... Java is useless when it comes to develop websites..only useful for mobile development..and microsoft is going to shift to mobile development too

  • @HardCoreProgrammer1 Java is useless when it comes to develop website !! LOL !! YFW, part of this website is made on java, also probably your e-bank account, imdb, part of google, yahoo, etc etc ... all mayor enterprises ... please learn, read and think before write kid

  • @Username7260

    I develop websites. I developed an asp.net website, and developing a php website right now.

    To slow to do everything with java when developing websites. This site could be built on asp.net with not a single line of code in asp.net.

    program first, talk later.

  • Execute on Linux.

  • also, i am of the opinion that if you hate c#, you probably will be a lousy c# programmer... I know im lousy at java!

  • I can make both language regex at the same speed! (excluding initialization)

  • JAVA 4 EVER

  • Comment removed

  • Java > C# > ActionScript > Ruby > Python > PHP.

    Bench by yourselves.

  • @2BeLivin C++ on top, of course!

  • @xboxnissan Ow, yeah. But I cited languages/scripts which run over virtual machines.

  • @xboxnissan no f-ing way! assembly is way faster. unless were talking high level. then fortran still wins! but im just giving you a hard time. i vote in favor of c++. who uses java or .net for huge time-critical number crunching anyway?

  • @you123123123123 you really are retarded. Nobody in the 21rst century programs in assembly. Java is good, C# is better and C++ is the best.

  • @xboxnissan It was a joke, but if you must know, assembly is still used alot. Many things are actually impossible in other languages.

  • I don't understand... some how I was watching minecraft lava flow videos and some how ended up watching this....

  • Smells like a troll with a camera.

  • @Firelinx lol loved your comment :p

  • Anyone can set a random number of loops and hooks in any type of code and make it run for a billion years. Show both sources for comparison and then MAYBE a statement could be made!

  • @alexgrinkov I don't see how Indians (if any) are pertinent in this, fact is you fail to see my point.

  • What the hell type of a benchmark is this?

    C# runs at native speed after the first run.

  • c# = simple

    Java = complex

    c++ =more complex

    c# = weak

    java = strong

    c++ = stronger

    This is my opinion so keep that in mind before replying something stupid.

  • @bloodyspitfire

    java is complex? since when? currently C# is more complex.

  • @bloodyspitfire c# weak? lmfao

  • @tobias7777777 i guess you forgot the part about my opinion or your just stupid.

  • @bloodyspitfire writing that its your opinion, doesnt change facts. C# is not weak, thats a fact, what you believe or not is completly unnecessery.

  • @tobias7777777 i wasnt even conversing facts, and to be honest it's a scale not a offense to some stupid facts. fucking idiot the whole point was to scale them in there own choice maybe you need to undefine "weak" as what it is and redefine it on scale.

  • damn you guys are really taking this too seriously :)

  • yes show us the code, asshole

  • I can't believe anyone can take that BS seriously... Some Java programmer is convincing himself he's not a luzer making such stupid FAKE reels. So what?

  • We need to see the code! If you can't show us the code, the benchmark means nothing.

  • Hmmm, ¿are you using the same algorithms in both programs?

  • Was the C# program precompiled first?

  • You should use a profiler if you can't code properly and have performance issues.

  • u are a fucking liar,it is  clearly seen

  • something wrong with your c# compiler/vm.

  • you just wasted my precious time. Please spend some time in improving your coding skills

  • Do you program for fun, or are you actually involved in commercial projects? If the latter, could you tell us which product(s) you are invovled in so that we can keep a safe distance from them?

    Thanks...

  • This test is clearly misleading. We can only conclude either poor programming or fake code. Couldn't be 100% sure but something as simple as "string" search or regex pattern lookup shouldn't be that hard to code. Actually being able to see what the code looks like would be much more pertinent. Oh, and I'm a Java programmer.

  • @GPurimu

    lol, C#'s regexp is known to be slow and buggy

    so much Indian butthurt in this thread

  • Why are we watching the terminal window? If you don't even have an IDE on your computer why should we believe the code is valid? You either A) Sabotaged the C# code to make it slower or B) Your just a moron. They could be close we don't know and your video isn't valid. Post the code. Thumbs up if you agree!

  • lol beautyfool FAKE!! JAVA IS the best with C++!

  • @Matista19 I still find the Java Graphics API to be really slow. Not because of poor programming practices but because Java uses software rendering for portability.

    On the other hand C++ and SFML uses Hardware rendering.

    Correct me if I am wrong but I don't believe there is an easy cross-platform way to access Hardware rendering in Java.

  • @autonomous2010 ok java it's very perfoemrs but java take much memory! and the BEST for hts is C++ =) same facebook use C++ with php because C++ is most light like php or java for example!! Java is most eazy!! there is no pointer!!! =)

  • @Matista19 Meh I very very rarely have to use C++ pointers.

    I can guarantee that Facebook does NOT use C++.

    Executables can't run in browsers. The exception of this is with IE and an ActiveX plugin but that is irrelevant considering Facebook is cross-platform.

    Facebook uses PHP, MYSQL, Javascript, and HTML.

    Just for the record, Java DOES have non-explicit pointers.

    If you really want as much speed as you can get, learn assembly. :-D

  • @autonomous2010 facebook does use C++ you're obviously disabled so I wont be discussing this... Just kidding, they do use server-side C++ though.

  • @katt157 Do they now?

    I was not aware of that and if that is indeed the case then I apologize.

    If you could elaborate on how they use server-side C++ other than to host the site then I would most appreciative.

  • @autonomous2010 Instead of reading PHP files through the Apache web server they hard code the pages in C++, so the server contains the site and wont have to read too many files and sch.

  • @autonomous2010 Yes but Facebook use HipHop it's Php who are executed with C++ compilator you can see this on this link here on google

    Enjoy my friend =)

  • @Matista19 good luck with that. Takes forever and huges amount of resources to compile that PHP. Most VPS setups where web devs run PHP sites won't handle compiling PHP with hip hop due to memory limitations during compilation (maybe now 2011 it got better, but when it came out, it was unusable for the avg PHP user)

  • @autonomous2010 OK, me for my web site i used like facebook but not with same level.

    Today I am trying to achieve my website with php for to make forum and blog with comment for all news =)so i listen your opinion for the futur of my website thanks bro =)

  • @Matista19 Java is as fast as C/C++ or even faster. Memory issues are not a problem today because RAM is CHEAP. Its 2011 not 1990. 640kb software is history.

  • @kurrator2 ok i see! but why C++ is again used for videos gamse and why not java??? =) but java is better because there is not pointer! me i learn java and php for my website =) , it's true like C/C++ is old

  • @Matista19 C/C++ does not give you straight advantage over Java, Its the matter of rendering/game engine. There are no good Java 3D engines at least last time i checked. Thats the reason.

    I wouldnt touch PHP if i were you. PHP is old, slow, non productive language for tiny and amateur web pages. If you want to go PRO google for Play! Framework.

  • post code.

  • It's true that Java is slower than .NET, but I still prefer java to c#, as it works not only on Windows, and it's pretty decent.

  • And what about Java + Aero Glass?

  • FAKE!! I prefer dotNet. Java has very ugly widgets.

  • hey i know tht C# is slow. but it is not too slow.

    it is ok'

  • anyway java craps on .net

  • lol, its fake, u can do this shit with cin.get(); or getch(); functions and it won't respond until u press anything. fake n' gay

  • Java is faster than c/c++? Ahahah for sure ! and 3D games are coded in... ? Java is slower than .net too!

  • Lol fake dude

  • It's all in the code, you could be doing the same things but ineffeciantly in either language.

    Also I saw you pause for like 20 seconds there

  • OK... seriously... you should first learn to code... and BTW... GET A LIFE!

  • Trying to demonstrate anything serious with computers using software with that pathetic logo down there in the left corner - that's simply a fail just because of that.

  • haha... probably in java "Thread.Sleep(10)" and in C# "Thread.Sleep(100000)"

  • coding: you're doing it wrong

  • You're doing it wrong

  • I loled.

  • It might be possible that you don't know coding :D

  • Too fast to be true, i know that because my aunt works in CSI

  • the maker probably doesn't even know what a JIT is.

  • What happens if java is really faster than C#, but what about productivity ?? C# FTW!

  • you made a mistake in your c# version of the code.

  • How about showing the C# source?

  • OK this looks faked to me. I have tested C#, Java and C++ many times. C++ is obviously the fastest but in my experience C# is generally faster than Java. Even if some implementation of Java is faster there should not be that much difference; nowhere near what this video shows.

  • bullshit!

  • Java, C# or C++ its same - just solve the problem. Only human resources are limiter, for two or three years we will have super computers who will execute all this shit in one second. I use language that is easiest for my developing, not faster for executing because clients don't give a fuck will code execute for one or three milliseconds more, but i give a fuck will i work one day or three for these milliseconds.

  • this experiment must be a joke, trying to convince noobs that java is better than C#. they're entirely comparable in most every way.

    I agree with this statement too - i pick the language that is going to give me the best development speed and not the one that runs fastest. Otherwise we'd all be writing in assembly language still and making no progress because we're repeatedly reinventing the wheel

  • LOL this is the most horrible benchmark i've ever seen

  • @evilthought Ok first of all Python's a scripting language while C# is an object oriented programming language so you can't compare the two and 2nd because of how Java is converted to system independant byte code instead of using a compiler like C# uses. Java wastes alot more memory and is slower than C# not to say one is better than the other but you are slightly misinformed

  • @ANXIOUS117

    Python and C# can accomplish the exact same things, so I think they are fair to compare.

    2nd, Java uses a compiler (like C#) to go to machine independent code (also like C#). They both compile twice (once at runtime) and both waste memory compared to C++. They use very much the same technology. Also, Java is still faster than C#. Source: shootout.alioth.debian org/u64/benchmark.php?test=all­&lang=java&lang2=csharp

  • @Hiei102493 not true Java is in no way faster than C# I don't know how you got this idea but its not true and you can't do the same things in Python as you can in C# Java wastes memory compared to C# and the biggestes difference between C# and C++ is pointers

  • @ANXIOUS117

    I tried to show the banchmark, but the URL does not seem to work as I posted it. After Source: in my previous post, take that url, put a dot between debian and org then change the arrow to lang and remove the spaces.

    Now, tell me what C# can do that python can't.

    Biggest difference is the fact that C# compiles to machine independent code.

  • @Hiei102493 well for one thing in C# you can use the DirectX set of API's a task I'm quite sure you cannot accomplish in Python

  • @ANXIOUS117

    google DirectPython

  • @Hiei102493 wow I did not know that but anyway you still can't really compare the two because they are two completely different languages

  • @ANXIOUS117

    They do generally serve different purposes, but I think they can be compared a little.

    The main difference is C#, Java, C++, C, etc are fast to run, but Python, Ruby, etc are fast to program. Their primary uses also differ a bit, but I have seen "scripts" and plugins in Java and C++ and games and programs in Python. See PyGame and Exaile for some good examples.

  • @Hiei102493 actually C and C++ are fast and efficient because of how close they are too the hardware they are also excellent with memory management due to the fact that you get to just when you free up your memory

  • @ANXIOUS117

    I agree with your reasoning, but the speed difference is smaller than I think you think it is.

  • @Hiei102493 not that I think I know it is

  • @Hiei102493 C# is not as effiecient or fast than C++ and is not as good with managing memory but serves its purpose Java sucks with speed and memory management but is more portable than all those languages there for it serves its purpose too

  • @ANXIOUS117 Java is still faster than C#

    Google debian language shootout and bring up the comparison of C# and Java. Java is quite a bit faster.

  • @Hiei102493 my source of information is from the college I go to ITT Technical institute not google I know for a fact Java is not faster than C# in fact companies are starting to gravitate towards C# instead of Java even though alot of colleges are now starting to teach Java because it teaches better programming practices than C#

  • @ANXIOUS117

    My source was not google, I just could not easily give you a url on youtube. That is a well respected benchmark. I have also done my own set of benchmarks and I can tell you that java is a bit faster on most tasks. Point me to one resource (that I can access) that disputes this.

  • @Hiei102493 probably your local library for one thing Java is always being critisized for how slow it is any programmer knows that Sunmicrosystems had to sacrifice speed for portability when they developed Java. Your Java source code runs through the compiler then through whats called a Java Virtual Machine

  • @ANXIOUS117 Also, this criticism is mostly from early java days when it was slow, but now, Java is nearly as fast as C++ and faster than C#. 

  • @Hiei102493

    Loool you're kidding me?

    Java is NOWHERE as fast as C++ and is a slower than .Net.

    C# Mono is slower than Java but C#.Net is faster I can assure you.

    Metadata is processed MUCH faster than Java Bytecode, Java uses more memory, Java has no high-level optimization, C# supports pointers which can be used to speed things up, .Net is much more polished etc..

    Have you ever heard ppl complain that C# is slow unlike this Java joke?

    * Knock Knock

    Who's there???

    * Long Pause

    Java

  • @Omgwtfbfgsauce Please show me a series of benchmarks that confirms your statement.

    Java may use more memory, I really don't know.

    OMG, you made up a joke about java!!! IMPOSSIBLE!!! I'll admit I am wrong now!!!

    Oh wait, I can do that too:

    * Knock Knock

    Who's there???

    * Long Pause

    C#

    Ooh, my point is now proved also. Paradox.

    Also, java is only called slow because it was at one time (up to 1.4ish). It is faster now, and until you can show otherwise, I am not believing you.

  • @Hiei102493

    1st of all if you had a certain amount of knowledge about MSIL and Java Byte Code you'd know which is faster. Java wasn't built for speed.

    I don't trust benchmarks unless they post the code itself and are from trustable sources such as debian btw.

    C# Mono is slower than Java Yes, but .Net is faster.

    That famous Java joke was meant to show you how much ppl complain about Java's slowness and NOT prove which is faster so changing it's context won't prove anything.

  • @Omgwtfbfgsauce Java might not have been built for speed, but it has had time to improve that.

    I am very skeptical when it comes to benchmarks as well, but they still mean more than you saying "C# is faster than Java."

    I am glad to know I am dealing with someone reasonable enough to trust Debian.

    I have seen some benchmarks (once again, they may have been wrong) that show Mono as faster than .Net

    The famous Java joke, like I said, was probably from a different era when Java was slow.

  • @Omgwtfbfgsauce Also, I have never heard that joke before. It doesn't seem all that famous to me.

  • @Omgwtfbfgsauce

    Mate are you kidding me,

    you cannot just say that C# is faster. I'm a C# coder myself, and it has it flaws that make in slower than java in some areas. In the end it comes down to the End User's Machine specs. Not the language itself.

  • @gm3dgames

    I didn't say that it's faster in every area because just as you might agree thats down right stupid. What I meant to say is that C#.Net is overall faster. As for C# Mono its definitely not as fast as Java so I'd give that to Java unlike some Java guys who are saying that Java is even faster than C/C++!!!

    I also agree that speed is nowadays not important at all especially with today's computers but this video is biased as hell and I'm reading some stupid comments so I had to post.

  • @Omgwtfbfgsauce

    ok my fault, i didnt interperate your post correctly then.

  • @Hiei102493 where its translated into device independent byte code called P-Code allowing a Java applet to run on a multitude of platforms like PDA's and Cell phones but because of this its a bit slower then most languages and it also is very bad at memory management and with C# well the only difference

  • @Hiei102493 between C++ and .Net are pointers because Pointers cause alot of security holes in software so Microsoft left them out of the language entirely

  • @ANXIOUS117 Yes, java is compiled then run on the JVM, but C# is compiled than run on the cli. It is the same process. Same tech, close to same speed. Java is just refined more.

  • @Hiei102493 no its not dude I'm not arguing with you anymore

  • @ANXIOUS117 Use a system language.

  • @nickrohn93 not its just Hiei for some reason keeps trying to tell me that Java is faster and better with memory management than C# and I know its not

  • @ANXIOUS117 You might be able to argue speed as it is very close and some (less than half) programs are faster on C#. Also, compiled C# is cross platform. If you compile C# on windows and send it to me, it'll run on mono (here in Linux). C# follows the same principal as java and is therefore quite similar in performance. Please, if you really believe I am wrong, send me any data.

  • @Hiei102493 a C# application will only run on a computer running the .Net Framework meaning only a Windows machine 

  • @ANXIOUS117 Shows how much you know. Google Mono.

  • The real situation ilustrated in a joke.: 1) Knock knock. 2) "Whos there?" 1) ... long long long long pause... "Java"

  • Eh, this is so stupid and clearly fake.

  • That's fake for sure. C is a LOT more faster than Java. Proved! And u can ask any specialist and it will prove it!

  • I presume you mean c#, and no its not faster. Nor is it useful. Why run code on a vm if your going to be restricted to a Microsoft platform.

    And hotspot is known to be faster than the KVM, its had nearly a decade of optimisations.

  • @MrMcQ2u I don't mean C#, ye, C sharp is limited to Windows but C, the programming language can walk on anything... And C is faster then java, u have to admit this, that's like ur saying that the car is faster then the plane, oh, sry, java is slower than C, and that's Fact, I don't say that I think so, that's FACT and u can't say something else, facts are facts...

  • Yeah.. C# and Java are sower than C on operating systems designed in C. Of course there is overhead. If the operating systems where created in managed code though I am not too sure you would notice a difference. Take a look at sunspot for an idea of what I mean, when drivers etc are all created in java.

  • @MrMcQ2u And still the most of the drivers are made in C/C++(Assembler is not used so often now). And how a programmer from google said: "If you seriously want to be a programmer u have to learn C/C++ first and then if you think you know C/C++ well recommended to learn Java, but if u just want to play a little in this domain u can learn just Java." - something like this. And he said that it is very important Not Java first and then C, but C first and then Java(Java if we want...).

  • Ok, but this video is java verses c#. C# is not C. I know Java, C#, C, C++, Vala Python etc and what you have just said is idiotic.

    It doesn't matter whether you learn C first(which I did learn first).

    You will only be as good as the amount of effort you put into understanding it.

    Go ahead and listen to Google though rather than thinking for yourself.

    I mean its not as if its the company that created the horrible piece of crap named Dalvik is it.

  • P.S the majority of people commenting here are idiots. C# is not C or C++. Its completely unrelated to those two languages in fact.

  • Piece of crap? Is one more awesome project. Search for it on youtube, u'll see how awesome this thing works... And I'm sure u use their searching engine! They made the fastest browser on the Mac... Don't want to comment more on this stupid words...

  • Yeah.. And they made a dogs with the chromium os, How do I know? Because I have seen the kernel patches they pushed. Your a moron, simple as. Google is not god, just because they have a god search engine doesn't make everything they say scripture.

  • Comment removed

  • This video is not real. You are going to tell me that C# (on windows even) is slower than Java? Please.

  • zZZZzzzzz c# = java xD

  • It is slow because you're just bad Programmierst.Java is 100% Slow

  • not only is java slow, all the java IDE are garbage, nothing even close to what WCF can do in terms of data binding, and how do you avoild silverlight ? :) and the cool + sexy wpf forms. java should be dead - take it from a programmer who got frustrated with 7 years of java programming. C# for the win.

  • Yeah.. Lets take a step back and recognise how successful silverlight has been while we watch videos on youtube through it.. Oh wait..

    Yeah you like pretty things but for the rest of us that need a real language Java is the solution.

  • @MrMcQ2u

    I have used Java for x many years then switched to C#. It's basically trash. Only novices stuck in your little world incapable of adapting are stuck to it.

  • I will let everyone who has chosen java including NASA know your amazing piece of advise. Must go back to tweaking the vm for cell architecture now.. Let me know when you take your head out of your ass. We can have a celebration.

  • @MrMcQ2u

    oh man i have been looking at some of their 3d animation work. even video game companies did better jobs like some 15 years ago. too many expensive and fail project because of people like you. thanks to people like me nasa has financial support. or we can all wait nasa to shift to india ...

  • Ur an idiot.

    Yeah.. Mars Rover is a failed project isn't it. It ran c# didn't it, oh wait no it didn't, it ran java. Nobody who is serious about programming cares about flashy graphics or xna.

    Your just a simpleton, oh well. Go back to wasting your life working on pointless things like games.

  • MrMcQ2u - do you know what OS 90% of the world uses ? It's called Windows. You "need Microsoft" Do you know what else they made ? C#. Java is going to die because not only is it compar. "slow on Windows" but have libraries which are not even 25% of what C# has, starting from creating strong Business layers to creating communication layers such as WCF. Beautiful GUI, compare Swing to WPF Apps / Silverlight to IDE. And don't tell me Java is faster than C# in Microsoft's own OS.

  • Take silverlight and wpf and stick it up your ass. You think anyone who takes there job seriously gives a shit about wpf or silverlight.

    Have microsoft sent windows or c# to mars?

    There's a reason why microsoft are not respected when it comes to mission critical application development.

    A reason their products are not used to keep planes in the air.

    Don't bother replying, just go play with xna and have fun being an unproductive moron.