gbulmer
Posts: 52
Joined: Wed Sep 28, 2011 9:11 pm

Re: Go programming language on R-Pi?

Sat Oct 01, 2011 5:28 pm

Has anyone tried to get the Go programming language working on R-Pi?
http://golang.org/

I don't think it is mainstream enough yet, but with Google behind it, it may get there.

There is an ARM compiler, which isn't as good as the x86 compilers, but they say they are working on Googles Nexus One, so I assume they will make progress.

Go lang has a few advantages over most other languages:
1. Very good support for concurrent programming, which is becoming increasingly important. Erlang demonstrates that concurrency and availability needs a different mind set, but it can be very productive if the language is designed from the ground up to do them well. Go lang may be less of a stretch for existing programmers.

2. Terse and productive as dynamic scripting systems

3. Safe and efficient as compiled, fully checked languages

This helps understand its goals:
http://golang.org/doc/go_faq.h.....w_language

If it gets more mature, it might be a great 'second language'

I don't expect to have any time to tinker with bringing it up on a new system this year, but if someone else has started, or even finished, I'd love to understand what you learned.

david13lt
Posts: 20
Joined: Thu Sep 08, 2011 4:55 am

Re: Go programming language on R-Pi?

Sat Oct 01, 2011 5:54 pm

I was thinking of using it about a year ago on Gumstix Overo COMs, but in that time they didn't have full support for ARM architecture. I think, they have finished porting most of the code now. I am looking at their page and it looks like optimizer is still not completed (should not be a problem) and for FPU they are using VFP unit.

I wanted to use go-lang for web services, but I must say, the performance was quite poor, especially with memory footprint.

Still, it would be nice to have it tested on R-P.

gbulmer
Posts: 52
Joined: Wed Sep 28, 2011 9:11 pm

Re: Go programming language on R-Pi?

Sat Oct 01, 2011 6:12 pm

Quote from david13lt on October 1, 2011, 18:54
I was thinking of using it about a year ago on Gumstix Overo COMs, ...
I wanted to use go-lang for web services, but I must say, the performance was quite poor, especially with memory footprint.
....
Big memory footprint? That is really interesting.
Was that the x86 compiler? I assume that was the most mature, so poor performance would be a bigger concern to me.
Approximately when did you do it?

They don't use Dynamic Linking for complexity, security and performance reasons!

Might be worth waiting until it matures a bit more?
Cheers GB-)

kardianos
Posts: 3
Joined: Tue Dec 13, 2011 10:31 pm

Re: Go programming language on R-Pi?

Tue Dec 13, 2011 10:52 pm

Sorry for a belated reply to this thread. ARM Linux is a supported platform in golang. Every commit is built on an ARM platform http://godashboard.appspot.com/. If you use golang, the memory alloc reserves a large virtual memory area, but is actually extremely efficient with ram.

I personally think it would be an excellent first language to learn. Try http://tour.golang.org/. It doesn't have a lot of graphics libraries, but it would be great for controller algorithms and websites.

And yes, it's stable now, I use a service I programmed a year and a half ago every day, and the language has gotten better. Go 1 will be out soon* and will have longer term support.
...
The top reasons I would promote it as a teaching language: It teaches pointers without letting you screw them up (no pointer arithmetic). You see exactly the memory layout you get. Garbage collection. Excellent documentation. All go code is written with the same formatting. Super fast compile times. Dead simple cross compiling from other computers.

-Daniel

hippy
Posts: 6257
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Go programming language on R-Pi?

Wed Dec 14, 2011 11:33 am

from http://golang.org/doc/go_tutorial.html
The one surprise is that it's important to put the opening brace of a construct such as an if statement on the same line as the if; if you don't, there are situations that may not compile or may give the wrong result. The language forces the brace style to some extent.

That's going to be a major limitation for people who reject that style and believe opening and closing braces should line up ( as with the BEGIN-END style of Pascal, Modula and Ada ).

I don't want to start a flame war on coding style or the merits and disadvantages of either style; just noting the issue which will have Go rejected by some through that. My opinion is that any language using braces or similar should facilitate either style, end of line should be consistently treated the same throughout a program.

Heater
Posts: 13910
Joined: Tue Jul 17, 2012 3:02 pm

Re: Go programming language on R-Pi?

Thu Apr 05, 2018 3:34 pm

Some years ago I had a play with Go.

The task was reading a stream of XML data over a socket , parsing it, filtering it and forwarding data to another socket.

I found that it was slow a stutery, obviously the garbage collector kicking in. Turned out I could get the job done with more performance using Javascript under node.js. Which is also easier and quicker to develop.

On the other hand, recently, I built the Cockroach database for a cluster of Pi 3 and it seems to work fine.

That is on a 64 bit OS though, pi64. I had heard, during my initial effort that Go had problems with it's garbage collector on 32 bit machines.
viewtopic.php?t=200748
Memory in C++ is a leaky abstraction .

ejolson
Posts: 3822
Joined: Tue Mar 18, 2014 11:47 am

Re: Go programming language on R-Pi?

Thu Apr 05, 2018 11:36 pm

Heater wrote:
Thu Apr 05, 2018 3:34 pm
I found that it was slow a stutery, obviously the garbage collector kicking in.
In my opinion the days of Go having a noticeably substandard garbage collection service are over. At the same time, if you are in to collecting garbage, there is no particular advantage to Go. Basic, Python and node.js have plenty of garbage to collect.

Until garbage collectors directly leverage the virtual memory hardware in modern processors, they remain relatively poor. Until virtual memory hardware is designed with the needs of garbage collectors in mind, nothing will change. Language performance remains stratified with Fortran at the top and Basic at the bottom. Go is somewhere in the middle.

Heater
Posts: 13910
Joined: Tue Jul 17, 2012 3:02 pm

Re: Go programming language on R-Pi?

Fri Apr 06, 2018 5:26 am

ejolson,
In my opinion the days of Go having a noticeably substandard garbage collection service are over.
That is good to hear. Perhaps I should revisit Go. Certainly Go is used for some major projects today that demand performance. CocroachDB and NATS for example.
At the same time, if you are in to collecting garbage, there is no particular advantage to Go. Basic, Python and node.js have plenty of garbage to collect.
Ha! Oh yes. I love collecting garbage. I have a house full of it!
Until garbage collectors directly leverage the virtual memory hardware in modern processors, they remain relatively poor.
Hmm... could you elaborate on what you mean there?

How would allowing garbage collectors to directly mess with the virtual memory be a good idea?

Virtual memory is just the mechanism by which memory addresses seen by a process are mapped to real, physical memory addresses (Which allows for processes to use more address space than there is physically RAM but that's another story.) How does changing the addresses hep with the GC problem?
Until virtual memory hardware is designed with the needs of garbage collectors in mind, nothing will change.
Same question in reverse I guess, how would hardware help GC?

It has crossed my mind sometimes to wonder why garbage collection algorithms have not been built directly into the processor's memory system. We have specialist hardware for floating point, vector operations, etc, why not GC?

It need not have anything to do with virtual memory though.
Memory in C++ is a leaky abstraction .

ejolson
Posts: 3822
Joined: Tue Mar 18, 2014 11:47 am

Re: Go programming language on R-Pi?

Fri Apr 06, 2018 6:01 am

Heater wrote:
Fri Apr 06, 2018 5:26 am
We have specialist hardware for floating point, vector operations, etc, why not GC?

It need not have anything to do with virtual memory though.
Agreed. Except you said it better.

Heater
Posts: 13910
Joined: Tue Jul 17, 2012 3:02 pm

Re: Go programming language on R-Pi?

Fri Apr 06, 2018 7:20 am

ejolson,

Of course the idea of hardware assisted garbage collection is far from new. Only nobody has thought of a good way to do it.

But now I find this recent proposal for hardware assisted GC by Krste Asanovi´c and others:
https://people.eecs.berkeley.edu/~maas/ ... 6-hwgc.pdf

Krste Asanovi´c has been designing processors and such for decades and is one of the initiators of the RISC V project.
Memory in C++ is a leaky abstraction .

Return to “General discussion”