Live data from Hacker News

.NET and Node.JS – Performance Comparison

salmanq.com

101–110 of 119 posts

Re: .NET and Node.JS – Performance Comparison

#101
post #82

Earlier quoted context omitted.

Still, there is nothing that annoys me more than when someone who is well versed in one toolset, and new to another toolset has the audacity to conduct a comparison and pretend like they did it correctly. I'm glad he provided source code, but he clearly doesn't know Node well enough to provide an Apples to Apples comparison. Maybe .NET will blow Node away? Fine, but make sure you know Node well before you do the test…

So, what's wrong with his Node code? What's the tell?

He doesn't know that node is single-threaded. Take an embarrassingly-parallel task (serving multiple unrelated requests, for example) and pit a single thread against multiple threads. Guess who's going to win?

Depending on the size of the .NET's thread pool, this probably more than accounts for the difference. The drastic inefficencies from not knowing what the async library does are just icing.

Re: .NET and Node.JS – Performance Comparison

#102
post #88
post #67

Earlier quoted context omitted.

Its not only that. For me, Visual Studio, the best single piece of software ever made, should be made available too - which unfortunately probably ain't gonna happen. It just saves so much time and makes the process such a breeze, that it was what converted me to windows to begin with...

Visual Studio is the greatest set of training wheels ever made. Beautiful, shiny training wheels that let you coast along and drink and eat without worrying about falling over. The people using the training wheels just don't understand why the big kids flying by on only two wheels would ever do such a thing. It's so much harder! I don't want to make my life harder. I have code completion and fantastic syntax, error d…

I'm not sure many people would use Vim/Emacs in real life. I don't know... maybe some people... certainly not pros.

Re: .NET and Node.JS – Performance Comparison

#103
post #48

I posted this comment: "It's obvious that you're new to Node.js. First of all, you should be aware that Async.js is a mere flow-control library. It does not offload work to separate threads, and neither is it able to parallelize work. Internally, it mostly does bean-counting (but very helpfully so). As you can see in the source https://github.com/caolan/async/blob/master/lib/async.js#L35... async.sortBy simply uses A…

> I can't comment about the quality of the .net code since I don't have any experience with it.

I'm by no means a .NET guru, but reading his code a couple non-optimal points jumped out at me:

- after parsing the file into an Array, he needlessly converts it into a List (while calling his variable 'array'). How bad this is is hard to say -- if the .NET compiler is sufficiently smart enough, it could optimize this to just a wrap operation, since the default List implementation uses an Array internally. That seems unlikely to me though. You'd have to check the generated code and benchmark.

- by sorting with the default string comparator, he's doing a culturally-aware unicode sort. I.e., the values are being sorted to "alphabetical" order, for however Unicode defines "alphabetical" for his current culture setting. A lot of people seem to feel it's obviously faster to compare the strings than the parsed floats. I don't think that's at all obvious.

Re: .NET and Node.JS – Performance Comparison

#104

Parsing floats rather than letting JS loose typing handle it for you kills your sort algorithm: http://jsperf.com/parse-or-no-parse-sort

"<" on strings is lexographic.

As noted elsewhere, lexographic sorting is how the .NET version is doing it.

Re: .NET and Node.JS – Performance Comparison

#105

Until Mono becomes 100% supportable, none of the advantages of .NET outweigh the misery of having to use Windows for development and serving.

I've put my foot down as long as I could about the joys of developing on Windows. But, since I've moved onto doing PHP and Python (with sprinkles of Ruby) full-time, I can't any longer. Windows has come a long way in terms of development of non-.NET languages. But, there are still too many idiosyncrasies to function as a full-time platform for many languages. Seems like my base need for Photoshop will push me to Mac…

care to name examples ? from my experience, especially when doing web development, the OS your tools run on does not really matter anymore.

Re: .NET and Node.JS – Performance Comparison

#106
post #48

I posted this comment: "It's obvious that you're new to Node.js. First of all, you should be aware that Async.js is a mere flow-control library. It does not offload work to separate threads, and neither is it able to parallelize work. Internally, it mostly does bean-counting (but very helpfully so). As you can see in the source https://github.com/caolan/async/blob/master/lib/async.js#L35... async.sortBy simply uses A…

I wrote a blog post with the correct node.js version: http://guillaume86.calepin.co/dotnet-vs-nodejs-performance.h...

The big performance hit for the node version is the float conversion.

Multithreaded .NET version is a bit harder to write because usually this work is delagated to ASP.NET/IIS.

UPDATE: the .NET version is actually already multithreaded because of the Task system, so Node.JS seems to be actually faster in this scenario...

Re: .NET and Node.JS – Performance Comparison

#107
post #94

Earlier quoted context omitted.

So instead of guessing, let's implement that corrected version of the node.js application and run the benchmark again. As other comments pointed already out, the main flaw in this post is NOT that the node.js implementation is not as efficient as it could be. It is that the author choosed to benchmark a CPU intensive task, as opposed to an IO intensive one. This is not what node.js is good at nor what it is typically…

imho, that's only half the problem. if you're bound to use .net for web stuff, chances are they will also force iis on you. suddenly you can't use httplistener anymore and you have build an httpmodule for iis. so now you either build your own handler or use one of the existing ones. i guess if you build your own isapi extension it's probably not very bad, but if you go through the asp.net "stack" it suddenly becomes…

This comment was made by a .NET lover on the article:

"Imagine that! An enterprise-class framework (.NET) is faster than Node.js (a boutique framework created just because someone could). Who woulda thunk it? Even if Node.js performed better, you couldn’t get me to switch. C# and .NET together are much, much too powerful a combination. With .NET I know that my application’s code will scale with my business."

sigh

This is why .NET can't have nice things. I have no issue with a lot of Microsoft's tools, but my God, the fanatical for no reason other than kool-aid training classes followers kill me.....

"scale with my business"??? Is he human, or is he a robot that randomly appends marketing slogans together into paragraphs?

Re: .NET and Node.JS – Performance Comparison

#108
post #88
post #67

Earlier quoted context omitted.

Its not only that. For me, Visual Studio, the best single piece of software ever made, should be made available too - which unfortunately probably ain't gonna happen. It just saves so much time and makes the process such a breeze, that it was what converted me to windows to begin with...

Visual Studio is the greatest set of training wheels ever made. Beautiful, shiny training wheels that let you coast along and drink and eat without worrying about falling over. The people using the training wheels just don't understand why the big kids flying by on only two wheels would ever do such a thing. It's so much harder! I don't want to make my life harder. I have code completion and fantastic syntax, error d…

so what you are saying is that the many brilliant game programmers, including the likes of John Carmack or Tim Sweeny, dont know what they are doing ? Not everyone in IT is writing dead simple CRUD web apps using scripting languages, but those guys seem to have the biggest egos...

Re: .NET and Node.JS – Performance Comparison

#109
post #48

I posted this comment: "It's obvious that you're new to Node.js. First of all, you should be aware that Async.js is a mere flow-control library. It does not offload work to separate threads, and neither is it able to parallelize work. Internally, it mostly does bean-counting (but very helpfully so). As you can see in the source https://github.com/caolan/async/blob/master/lib/async.js#L35... async.sortBy simply uses A…

I wrote a blog post with the correct node.js version: http://guillaume86.calepin.co/dotnet-vs-nodejs-performance.h... The big performance hit for the node version is the float conversion. Multithreaded .NET version is a bit harder to write because usually this work is delagated to ASP.NET/IIS. UPDATE: the .NET version is actually already multithreaded because of the Task system, so Node.JS seems to be actually faster…

I ran it too and came to the same conclusion: problem in the original comparison is that CPU usage of the node version never gets over 40% on my laptop, while the .NET version uses 100%. Using Array.sort() makes little difference. Adding threads to the node version does. I think also adding threads to the .net version wont help it much; it already uses 100% CPU.

Re: .NET and Node.JS – Performance Comparison

#110

Earlier quoted context omitted.

I wrote a blog post with the correct node.js version: http://guillaume86.calepin.co/dotnet-vs-nodejs-performance.h... The big performance hit for the node version is the float conversion. Multithreaded .NET version is a bit harder to write because usually this work is delagated to ASP.NET/IIS. UPDATE: the .NET version is actually already multithreaded because of the Task system, so Node.JS seems to be actually faster…

I ran it too and came to the same conclusion: problem in the original comparison is that CPU usage of the node version never gets over 40% on my laptop, while the .NET version uses 100%. Using Array.sort() makes little difference. Adding threads to the node version does. I think also adding threads to the .net version wont help it much; it already uses 100% CPU.

Good idea to look at the CPU usage. To be complete I should show CPU/Memory usage under load but I've already spent enough time on this ;).
Post reply on HN