Live data from Hacker News

Go as an alternative to Node.js for Very Fast Servers

techblog.safaribooksonline.com

61–70 of 147 posts

Re: Go as an alternative to Node.js for Very Fast Servers

#61

I was curious, so I actually ran both of the servers from the article on my little MacBook Air. The results are below. First, go: $ ab -c 100 -n 10000 http://localhost:8000/ This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 1000 requests Completed 200…

In the comments of the article are some test results too, only that on that test, nodejs was slightly faster.

Re: Go as an alternative to Node.js for Very Fast Servers

#62
post #58

Earlier quoted context omitted.

More like: Anything web HAS to be Javascript (cause the calendar says 2013 but apparently it's 1970), no choice so oh well, we'll try Javascript on the server cause God knows using the same language everywhere is a good thing :/ Go: The language is in its infancy, growing at a slow pace for now, bears some promises that are yet to be confirmed. Java: For some reason people still hate the language even though it's the…

> For some reason people still hate the language even though it's the closest to being the most versatile language around (in every single aspect that makes a good language it ranks well against the others) In every respect that a PHB may care about, perhaps. I think you should examine that "for some reason" more carefully before declaring that all reasons favor Java. Clearly there is something going on there, unless…

Well, I know lots of programmers who do like Java, you just don't see them that much on Hacker News. Reasons:

- Availability of good IDEs.

- Good dependency management and build infrastructure via Maven.

- Quick and easy deployment via servlet containers.

I am not a big Java fan, but having written quite much code, feature-wise there are not that many advantages of Go over Java. Package management in Go is nice for an early system, but will become a mess eventually, since there is no version management at all. Goroutines and Gochannels are nice for concurrency, but not all that great for parallelization. Java has generics, checked exceptions, and a good garbage collector via the JVM.

I don't hold much hope for the development of Java the language, but the JVM is a great platform, with many interesting languages (Scala, Kotlin, Clojure), that attempt to solve problems that Go doesn't solve.

Re: Go as an alternative to Node.js for Very Fast Servers

#63
post #5

While JavaScript drags the scars of its hasty standardization around with it, Go was designed very thoughtfully from the beginning, and as a result I find that it’s a pleasure to write. This is very true. Go is a pleasure to write. In fact, it's such a pleasure then when you hit something that wasn't really well designed it's horrid.

Can I ask what language you are used to? I hear how nice go is as a language a lot, but coming from haskell, go is hideous in comparison.

Define hideous.

Re: Go as an alternative to Node.js for Very Fast Servers

#64
post #58

Earlier quoted context omitted.

More like: Anything web HAS to be Javascript (cause the calendar says 2013 but apparently it's 1970), no choice so oh well, we'll try Javascript on the server cause God knows using the same language everywhere is a good thing :/ Go: The language is in its infancy, growing at a slow pace for now, bears some promises that are yet to be confirmed. Java: For some reason people still hate the language even though it's the…

> For some reason people still hate the language even though it's the closest to being the most versatile language around (in every single aspect that makes a good language it ranks well against the others) In every respect that a PHB may care about, perhaps. I think you should examine that "for some reason" more carefully before declaring that all reasons favor Java. Clearly there is something going on there, unless…

Let me clarify then:

I think that a consensus was built in the mid-90s that Java was a pain in the ass and not an improvement over what was available in that particular field at the time (not as easy as other higher-level languages and not as good or fast as C or C++).

I have a feeling that people over time consolidated that consensus through some form of confirmation bias even though the Java/JVM ecosystem had made strides towards a brighter future. And I say that as someone that doesn't even like Java in the first place (or at least doesn't see himself enjoying coding with it).

But it's hard in 2013 to look at what Java and the JVM brought to the table with disdain. Java is nowadays a very fast language that deals with memory management extremely well (not a good feature in some fields of course, embedded or real-time systems come to mind), that offers a rather sane Java-flavoured OOP paradigm, tons of tools (from IDEs to debuggers to servers) and an extremely well-crafted documentation.

The JVM also enabled Scala, Clojure, JRuby, Rhino, Vert.x, etc.

Now I totally understand and agree that the picture of Java nowadays is still far from perfect but I was more pointing at the slight disconnect between the actual capacities of the language and its perception by the programming world at large. Overall Java and the JVM are pretty damn good tools to use and meet the needs of lots of different niches.

Re: Go as an alternative to Node.js for Very Fast Servers

#65
post #27

Earlier quoted context omitted.

What about Go makes it easy to manage and refactor large codebases? I don't do much Java, but whenever I've watched someone use Eclipse for refactoring, I question why I'm still using vim, because it is just magic and does everything for you.

I should probably write a blog post about this, because it's a combination of a number of things. Primarily, the compiler is incredibly strict and opinionated, so it's impossible to make certain small errors like assigning to lvalues that are never used, importing packages that are never used, etc. Secondarily, gofmt makes code very standardized and easy to skim. It takes Python's 'only one (obvious) way to do it' on…

But go ecosystem still doesn't have anything even close to refactoring abilities of Java/C# IDEs. Say, move Java class which is in use in 100s places from one package to another is just few mouse clicks in Eclipse and a lot of pain in case of Go.

Re: Go as an alternative to Node.js for Very Fast Servers

#66
post #49

Earlier quoted context omitted.

You are contradicting yourself about parametric polymorphism. First you acknowledge it doesn't exist, then you claim a limited workaround solves it. >It's definitely not harder to prototype in - and I say this as a functional programmer Have you used haskell to make the comparison? >if you're writing Go idiomatically, you really shouldn't be thinking very much about the types as you write them. I don't understand whe…

I have been wanting to learn Haskell for some time. Is Real World Haskell still the best book for the language? Could you point me to some well written libraries/projects that are considered idiomatic haskell? Would appreciate the pointers.

There's lots of books: Hutton, Hudak, Thompson, Richard Bird. I have a ugly draft/link dump for learning

http://isthishaskell.blogspot.com/2013/02/tips-on-learning.h...

Re: Go as an alternative to Node.js for Very Fast Servers

#67
post #5

While JavaScript drags the scars of its hasty standardization around with it, Go was designed very thoughtfully from the beginning, and as a result I find that it’s a pleasure to write. This is very true. Go is a pleasure to write. In fact, it's such a pleasure then when you hit something that wasn't really well designed it's horrid.

I've done Java, PHP, Objective Caml (in college for a few years), some basic C, Ruby and Javascript before and I concur. Go is a real breath of fresh air. I have the same feeling I have when I code with Ruby: that sense that the language works WITH me, that the whole experience is smooth and seamless. I wish Go stays on that path for a long time. And it never gets TOO big, which makes for awful communities.

Maybe you didn't do much OCaml? I've found it to be mostly significantly better than Go, especially with it's type system. Go's type system is relatively limited and ad-hoc where OCaml's is extremely elegant, simple and consistent.

In particular, OCaml has an awesome module system and a great take on structural sub-typing combined with proper type inference and sane parametric polymorphism.

Having actual algebraic data types is night and day to Go's more limited structs. OCaml also has a good object system which people don't use too often but can come on very handy.

Re: Go as an alternative to Node.js for Very Fast Servers

#69
post #65

Earlier quoted context omitted.

I should probably write a blog post about this, because it's a combination of a number of things. Primarily, the compiler is incredibly strict and opinionated, so it's impossible to make certain small errors like assigning to lvalues that are never used, importing packages that are never used, etc. Secondarily, gofmt makes code very standardized and easy to skim. It takes Python's 'only one (obvious) way to do it' on…

But go ecosystem still doesn't have anything even close to refactoring abilities of Java/C# IDEs. Say, move Java class which is in use in 100s places from one package to another is just few mouse clicks in Eclipse and a lot of pain in case of Go.

Not really. Go comes with code rewriting tools, unsurprisingly since they were used to update the standard library and 3rd party code when the language changed before Go 1.

I don't want to use a language that doesn't come with a parser in the standard library anymore.

Re: Go as an alternative to Node.js for Very Fast Servers

#70

I was curious, so I actually ran both of the servers from the article on my little MacBook Air. The results are below. First, go: $ ab -c 100 -n 10000 http://localhost:8000/ This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 1000 requests Completed 200…

It'd be interesting to throw Erlang into the mix, too.
Post reply on HN