element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Single-Board Computers
  • Products
  • Dev Tools
  • Single-Board Computers
  • More
  • Cancel
Single-Board Computers
Forum Google Go on ARM
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Single-Board Computers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 26 replies
  • Subscribers 59 subscribers
  • Views 3020 views
  • Users 0 members are here
  • debian
  • bbb
  • go
  • rasperry_pi
  • golang
  • arm
Related

Google Go on ARM

morgaine
morgaine over 12 years ago

Ealier today, selsinork wrote in another thread (new one here owing to my change of topic):

selsinork wrote:

 

Interestingly,  it's not so long ago that x86 systems were far less capable in terms of  memory, storage and likely CPU than today's ARM systems, yet were  perfectly capable of compiling everything required natively. How quickly  we forget, and how quickly we bloat the software with unnecessary junk  to the point this is no longer true.

That is so very true!!!

 

Software technology needs occasional revolutions too, just like society, to remove layers of accreted crud.  This happens so rarely in computing alas that we're up to our eyeballs in it and barely keeping our heads clear.  It is so rare that I'd like to highlight one relatively recent instance of it, although it is admittedly a revolution with a small 'r'  as it hasn't captured much mindshare in the computing industry.  It's the programming language Google Go.

 

It's not the Go language syntax nor semantics that are revolutionary,  although it is nice enough in both respects and has lots of very effective features especially for concurrent programming.  What is revolutionary about it is its implementation meme, which renouces the idea that building software is divorced from language definition and is performed by third party tools ("make" and its many equivalents in the commandline and IDE worlds) with limited knowledge of the language beyond syntax.  That almost universally prevalent idea has slowed down system building to a crawl right across the world of computing, and it's almost single-handedly reponsible for the problem you described.  (I'm referring to build time only here.)

 

Instead, Go provides integrated build tools and a software construction meme in which to compile a module requires looking only at its immediate dependencies, no further.  In other words, if module A is dependent on B, and B is dependent on C, then to compile A does not require looking at C.  (No explosion of header file lookups.)  Extrapolate this to complex systems with many layers of dependency in breadth and in which each dependency is itself dependent on multiple layers of dependency in depth, and as you can imagine, Go application building can be literally orders of magnitude faster than in most of the languages in common use today.  Many compiles are pretty much instantaneous despite having lots of dependencies.

 

That's "revolutionary" of the kind that removes decades of accumulated crud which has slowed down our systems to a crawl.  It's worth spreading the word about it.  Oh, and it works on ARM, not as efficiently as on x86 yet but it's improving all the time.  I think we should be using Go very widely for as much as possible outside the kernel.

 

Just today on one of my BBB's with Debian installed:

debian@bbb:#  apt-get install golang

...

Need to get 21.9 MB of archives.
After this operation, 81.4 MB of additional disk space will be used.

...

debian@bbb:$  go version

go version go1.0.2

debian@bbb:$  vi hello.go

debian@bbb:$  cat hello.go

package main

 

import "fmt"

 

func main() {
        fmt.Println("Hello, World!")
}

debian@bbb:$  go build hello.go

debian@bbb:$  ./hello

Hello, World!

debian@bbb:$

Viva la revolucion!  image

 

More seriously, it still has a long way to go in a few areas (integration/interoperation is one), but I see very good things ahead for Go.  I recommend that engineers add it to their toolbox and gradually expand their use over time.  Expect huge reductions in crud / time gains on large projects.

 

 

Morgaine.

  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 12 years ago in reply to morgaine +1
    Morgaine Dinova wrote: The result isn't in dispute. Anyone can experience it for themselves The result is rarely in dispute. At least not by anyone willing to do some simple comparisons. History, however…
  • morgaine
    morgaine over 12 years ago in reply to Former Member +1
    selsinork wrote: History, however, is littered with cases of the inferior choice 'winning'. VHS vs Betamax ? RPi vs * ? Yeah, but fortunately we can leave the discussions about "winning" to the respective…
Parents
  • Former Member
    Former Member over 12 years ago

    That almost universally prevalent idea has slowed down system building to a crawl right across the world of computing, and it's almost single-handedly reponsible for the problem you described.  (I'm referring to build time only here.)

    Actually, C has the nice feature that compilations can be done in parallel,

    using -j or --jobs, so having a multi-core machine can speed up compilation nicely.

    I think in order to have Go's transitive compilation independence, your data structures

    need to (implicitly) use a lot more indirection, so you pay a run-time performance penalty,

    although I have not looked at Go closely.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 12 years ago

    That almost universally prevalent idea has slowed down system building to a crawl right across the world of computing, and it's almost single-handedly reponsible for the problem you described.  (I'm referring to build time only here.)

    Actually, C has the nice feature that compilations can be done in parallel,

    using -j or --jobs, so having a multi-core machine can speed up compilation nicely.

    I think in order to have Go's transitive compilation independence, your data structures

    need to (implicitly) use a lot more indirection, so you pay a run-time performance penalty,

    although I have not looked at Go closely.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • morgaine
    morgaine over 12 years ago in reply to Former Member

    That's not a C feature, it's a feature of make:

    make  -j [jobs]  --jobs[=jobs]

    Make knows almost nothing at all about C, so if you've added the -j option to its compilation flags it'll merrily kick off concurrent builds for anything that the Makefile hasn't specifically ordered through sequential dependencies.  The most common candidate is to build concurrently all the .o files listed on the RHS of a target, but it does so without understanding why, ie. merely because its Makefile has been configured that way.

     

    And what's worse, those many instances of the C compiler that have been kicked off by make will all process the same C header files repeatedly and independently, only slightly held back from total insanity by the magic #ifdef-#include-#endif incantations in the .h headers which are added manually by programmers, not a feature of the language system.

     

    It's very different in Go.  The "go" build utility doesn't obey a configuration file at all, and instead it digs out the dependency information directly from the module being compiled.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to morgaine

    That's not a C feature, it's a feature of make:

    What I meant is that it's a feature of C that compilations can be done in any order or in parallel,

    so you can use make's -j feature. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • morgaine
    morgaine over 12 years ago in reply to Former Member

    coder27 wrote:

     

    What I meant is that it's a feature of C that compilations can be done in any order or in parallel,

    But that's not really a feature of C, it's a feature of the reentrancy of language compilers in all Unix-like systems and indeed in all sane operating systems everywhere.  I can't think off-hand of any current-day language compiler that can't compile two different sourcefiles concurrently on a multitasking system even in the same directory, and the only reason why they won't usually compile the same sourcefile concurrently twice over is because this would normally result in concurrent writing of the same output file which is likely to result in corruption.

     

    Make -j makes good use of this general reentrancy of compilers (and it never attempts to compile one and the same file concurrently), but it's not a feature of the languages themselves.  Make just obeys its makefiles, and does exactly the same whatever the language.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to morgaine
    The "go" build utility doesn't obey a configuration file at all, and instead it digs out the dependency information directly from the module being compiled.

     

    That's a feature that languages like Ada have had for 30+ years.

     

    But if module A depends on module B depends on module C,

    and C declares a struct, and B declares a struct that uses C's struct,

    and A declares a struct that uses B's struct, then the field offsets in

    A's struct depend on the size of C's struct, so if C changes, you have

    to recompile A even though A doesn't directly depend on C.

     

    To avoid that transitive dependency, you have to access structs indirectly.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • morgaine
    morgaine over 12 years ago in reply to Former Member

    No, when compiling A then Go doesn't need to consider C.  C is a dependency for B, and therefore any change in C means that B is no longer up to date, so the "go" build tool will rebuild B first before it starts on A.  Then when compiling A it will examine only B, not C.

     

    Maintaining a module dependency graph and propagating changes made at the leaves upwards is far less intensive than having to consider the full set of data structures in the program through deep traversal during compilation.  What's more, updating the modules is a once-only process until the next time that a leaf is changed,  The difference in traversal times is potentially orders of magnitude.  Go needs to open very few files while compiling a module.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    coder27 wrote:

     

    To avoid that transitive dependency, you have to access structs indirectly.

    and you need a pile of metadata to do that - I guess that's what you meant when you talked about a run time performance penalty ?

     

    When you're doing this sort of thing aren't you also effectively at least laying the groundwork for if not actually implementing reflection/intorspection and thereby straying into java/c# territory ?  I'm still not convinced that's a good thing, there's a price to be paid for this sort of thing, the only difference is whether you pay it up-front or at runtime.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to morgaine

    No, when compiling A then Go doesn't need to consider C.  C is a dependency for B, and therefore any change in C means that B is no longer up to date, so the "go" build tool will rebuild B first before it starts on A.  Then when compiling A it will examine only B, not C.

     

    You are describing how languages like Ada have managed dependencies for 30+ years.

    Is that what you mean by revolutionary?

     

    btw, Kuhn teaches that in order to have a scientific revolution you first need to have

    a scientific paradigm, and I think he would consider computer science to be pre paradigm.

    You don't see anyone suggesting to do scientific experiments in computer science where

    for example you might implement a large project in two different programming languages to

    see which works better, or teach two sections of an introductory programming class, using

    two different languages, to see which section does better.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    coder27 wrote:

    To avoid that transitive dependency, you have to access structs indirectly.

    and you need a pile of metadata to do that - I guess that's what you meant when you talked about a run time performance penalty ?

     

    exactly.  Although I think I initially misunderstood what Morgaine was saying about Go not having transitive dependencies.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • johnbeetem
    johnbeetem over 12 years ago in reply to Former Member

    coder27 wrote:

     

    ... You don't see anyone suggesting to ... teach two sections of an introductory programming class, using

    two different languages, to see which section does better.

    I suspect the result will be that whichever has the better teacher who is more enthusiastic about the language being taught will do better.  For example, I'd do better teaching ASM than C++ because I love the simplicity and hands-on character of ASM versus the complexities of C++.  JMO/YMMV.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • morgaine
    morgaine over 12 years ago in reply to Former Member

    If you're hung up on the word "revolution" I'll withdraw it, since it's not essential to my point.

     

    My point was to answer selsinork's correct observation that our computing systems have become bloated with so much unnecessary cruft that they behave like machines of yesteryear despite being far more capable on spec.  I offered Go as a very practical example of the removal of accumulated cruft, since it compiles extremely fast by combining an effective module system that eliminates deep traversals of dependencies and a language-aware build tool that uses knowledge of that module structure to reduce compilations to a minimum, without manual configuration.

     

    The result isn't in dispute.  Anyone can experience it for themselves by compiling the entire Go compiler suite in a few seconds and the entire modules library in a small number of minutes.  The gcc equivalents (if an analogous set were to be constructed as fairly as possible) would take many hours to build.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube