4 ms·
Another gonatic? I'm immediately reminded of the days when everyone who liked D proclaimed it would overtake C++ and rule the world with terrible, contrived ex
by just2n 14y ago
Another gonatic? I'm immediately reminded of the days when everyone who liked D proclaimed it would overtake C++ and rule the world with terrible, contrived examples: "let me show you why my language is better than yours by completely misunderstanding how to solve a problem, then implementing that broken/overengineered solution in your language, then compare it to something my language's API can do for me, just so we can see how much simpler that bad solution is in my language!"
The insight to async I/O is that this server, for this I/O bound task, will perform as well as your GOMAXPROCS example:
require('http').createServer(function(req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
But it's a lot simpler. You don't need to bolt on parallelism when you don't actually need parallelism. There are valid reasons to use Go, and there are valid complaints against Node. I don't see any of either here.
- aaronblohowiak 14y ago>The insight to async I/O is that this server, for this I/O bound task, will perform as well as your GOMAXPROCS example: Will it? Luvit, which is implemented on Node's libuv outperforms Node in the trivial case because of higher lua performance (and lua->c interop performance).
- just2n 14y agoI'd be interested in a more in-depth look at why this might be the case, because in JS written such that V8 will optimize properly, it's generally faster.
- aaronblohowiak 14y agoIIRC, you can't tell v8 to keep memory in the same place (it can and does move things around as part of its gc).. this complicates sending strings to the socket, so you have to make a copy from the v8 world to some other world before initiating the async write.. i believe (suspect?) that lua does not have this limitation, so the extra work involved is not necessary.. this is based on old, vague notions so I may be off my rocker, but it is the best of my understanding. I would love a detailed look.
- st3fan 14y agoPeople please .. stop the four line code comparisons. Write something serious instead and then see how it compares. Like for example show me how to suspend the HTTP request and wake it up later when you receive a message back from some long running process. Or simpler: show me how to start a long running async task from a request handler.
- just2n 14y agoI do believe that's what I said. The comparisons the OP gave aren't useful because the trivial example does not require parallelism, so it amounts to little more than complaining about the lack of features in Node. I'd like to see some nontrivial case studies as well.
- SeanDav 14y agoBig difference is that D did not have a Google backing it and D had a fairly major falling out by different factions. This was a great pity because I think it probably is one of the best languages ever made and didn't get the take up it absolutely deserved.
- erichocean 14y agoAnd we all know that whatever Google backs, is successful. /s
- enneff 14y agoThe big difference between D and Go is that D is another kitchen sink language. It has almost all of C++'s features, and more! Conversely, Go has many fewer features than C++ or D, and many argue that this is Go's biggest selling point.
- slurgfest 14y agoIf Google itself is really backing anything, it is Java.
- slurgfest 14y agoSomeone should probably write a refresh to HQ9+ to include a web hello world as well as a Fibonacci server, and perhaps the Arc Challenge as well. (For more information on HQ9+, go here: http://web.archive.org/web/20090602074545/http://www.cliff.biffle.org/esoterica/hq9plus.html http://web.archive.org/web/20090602074545/http://www.cliff.b...)
- mseepgood 14y ago> The insight to async I/O is that this server, for this I/O bound task, will perform as well as your GOMAXPROCS example No, it doesn't scale on multiple CPUs if you don't use the 'cluster' package.