It is likely you are using new (and/or 'make') in the naive way, and this naive way will invite the garbage collector in your Go program to use a lot more memory than needed.Heater wrote:This perhaps not the thread to ask in but I have been trying out Go and node.js on ARM boards including the Pi and I have found that Go is incredibly slow compared to node.js. A somewhat surprising result.
Basically I have a simple websocket client written in both JS and Go which simply connects to a server and then pumps out little structures in JSON as fast as possible.
JS can do this almost 10 times faster than Go.
Looking at how it runs I see the Go version is stuttering and stalling for every second or so, looks like a garbage collection issue.
Anyone have any thoughts about this? I could post the code somewhere if you like.
Probably because Go is a very young programming language, where the garbage collector(GC) is more simple than compared to the GC in the JS engine, and thus requires you to think more about how you are using memory.Let's assume both my JS and Go programs are written the most naive way, which is probably true. So they both need to do a lot of memory allocation, deallocation and garbage collecting. How come the Go garbage collector is so much worse?
I guess that you are not used to profile your programs.If I'm having to all that work profiling and changing my code in order to mach the speed of JS I might as well use JS in the first place.
Oh but I have. Often the idea is to never use memory allocation and garbage collection, in real-time embedded systems for example.I guess that you are not used to profile your programs.
On my netbook (i386 arch, Linux OS) i get:jpmathew wrote:I compiled go1.4.2 on the Pi, and then compiled go1.5 using the 1.4.2 as a go compiler.
This worked OK, except for a couple of tests. But when I check go version it shows go version devel +2468227 instead of 1.5.
Used go 1.5 and compiled some code and it seems to work. Need to check goroutines. Got gosigar working OK.
Is the go version an error?
Code: Select all
go version go1.5 linux/386