text
stringlengths
0
1.82k
• Approachability of contributing to the compiler for those with minimal knowledge
• Compiler knowledge requirements for beginners
• Recommended reading for understanding compiler concepts (The Dragon Book, graph algorithms book)
• Gopher Academy blog posts and opportunities for contributing
• GoLab conference in Italy
• Dominik Honnef's toolchain documentation and examples
• Proposal to make Damian Gryski top moderator on the Golang Reddit channel
• Community moderation and involvement with the Go project
• Open source projects can be fixed by users themselves without relying on others.
• Contributing to open source projects can be intimidating due to fear of being rejected or not meeting expectations.
• Small, imperfect patches can still lead to valuable dialogue and potential solutions.
• There is growing interest in using Go for data science, math, and InfoSec applications.
• The JSON Incremental Digger (JID) tool allows navigation and manipulation of large JSON files on the command line.
• The Delve debugger is a popular and useful tool for debugging Go programs.
• Using pre-built components and libraries can greatly simplify projects, as seen in the Arduino and Maker community.
• Raspberry Pi-based PID controller for smoker uses Go to calculate error value and adjust blower
• Meat probe side of project being worked on, aiming to merge with existing code
• Goal is to plot temperatures in the grill using Prometheus
• Project timeline uncertain due to limited time availability
• Show wrap-up, thanking guest Keith Randall for his work and sponsors StackImpact and Backtrace
**Erik St. Martin:** It is episode \#27 of GoTime. Today on the show we have myself, Erik St. Martin, we have Carlisia Pinto...
**Carlisia Thompson:** Hi there.
**Erik St. Martin:** Brian Ketelsen is out today, and filling in for him today is Bill Kennedy. Say hello, Bill...
**Bill Kennedy:** Hi, everybody.
**Erik St. Martin:** And our special guest today actually taught us all how to make a lot of profit using maps at GopherCon. I'm still waiting for my check, but on the show today is Keith Randall from the Go team.
**Keith Randall:** Hello, everybody.
**Erik St. Martin:** Do you wanna give everybody a rundown - who you are, what you do specifically on the Go team?
**Keith Randall:** Sure. I work on Go runtime internals and compilers. I work on making Go faster, all behind the scenes. You don't sort of see anything I do in APIs or anything like that, but every release we make things a little bit faster and a little bit less memory, and all-around better.
**Erik St. Martin:** That's awesome. So you specifically work on the compiler and runtime?
**Keith Randall:** Correct. I sort of started out working on Go, working on runtime things like maps, scheduler, some of the type conversion stuff and so on. More recently I've been working on compiler internals, making generated code better, smaller, that sort of thing.
**Erik St. Martin:** That's awesome. Have you played a big role in SSA stuff that happened over the last couple of releases?
**Keith Randall:** Yeah, so I started the SSA backend project, proposed it, got people on board with it and sort of was the tech lead for it. I wrote the first prototype and then got a bunch of other people both from inside Google and outside to help work on it. It was released in 1.7 for amd64. For this upcoming relea...
**Erik St. Martin:** Oh, nice.
**Keith Randall:** Yeah, and the performance we get on x86, it was something like 20% better. It very much depends on the application, but we're getting on average about 20% better, mostly because the x86 chips are really good at executing bad code, so you really have to do a good job of making better code before you c...
**Erik St. Martin:** Yeah, and ARM needs the love even more, because ARM typically doesn't have the clock rate that an x86 chip does.
**Keith Randall:** Right, absolutely.
**Erik St. Martin:** Those performance improvements help a lot.
**Keith Randall:** And the performance improvements help save power, too. That's also a big thing.
**Erik St. Martin:** Yeah, that's true as well. We should probably circle back a little bit to when we talked about SSA and maybe give a brief explanation of what SSA is and why that benefits us to have the compiler leverage SSA.
**Keith Randall:** Okay. I guess at first it'd help to describe what the old compiler was like. The old compiler used to take the abstract syntax tree of a Go program and would generate code sort of node-by-node on that syntax tree. If there was a plus, it would load both arguments into registers, do the plus and then ...
\[04:02\] It would do that one at a time on the nodes of the syntax tree, with no look ahead, very little look behind... The code it generated wasn't very good, because there were a lot of moves you didn't need, there were a lot of operations that if you did that same add twice, it would execute that add twice instead ...
So SSA instead takes the abstract syntax tree and builds a control flow graph, and a value graph. And then we can do all sorts of optimizations on that graph, like common self-expression elimination, we can do bounds check elimination, we can do better scheduling, dead code elimination, all that sort of stuff - all of ...
SSA compilers have been around for a while. I know I've worked on one 15 years ago, so it's a pretty mature compiler technology. GCC uses it, LLVM uses it... It's a pretty common compiler technology. This is not sort of a researchy thing; SSA is known to be a good way to generate code for compilers. We need to get Go u...
**Bill Kennedy:** I've got a quick question, because I've always tried to visualize these things that are going on... So this piece is happening inside of the compiler; is this helping to generate that intermediate assembly? Is that kind of where this is? Where in the toolchain between the compiler, the assembler and t...
**Keith Randall:** Fair enough. So when you start with Go code, there is a parser that basically takes that Go code and makes an internal in-memory representation of the abstract syntax tree. From there, SSA takes that abstract syntax tree and generates assembly code, that is actually sort of an in-memory representatio...
**Erik St. Martin:** Okay, so this would actually be an IR... Bill and I were actually kind of having this debate before the show - the difference between an intermediate representation and an intermediate language. And the best I could come up with is that an intermediate language is actually produced code, whereas IR...
**Keith Randall:** Yeah, I don't think I've ever heard the term "intermediate code"...
**Erik St. Martin:** Or intermediate language.
**Keith Randall:** Yeah, or intermediate language... I don't know. It's a good question. So LLVM has something which maybe I would call an intermediate language; it's an actual textual representation of the IR.
**Erik St. Martin:** Yeah, that was my interpretation of the difference between the two. I've always heard IR, and then Bill said IL this morning and I was like, "Hm..."
**Bill Kennedy:** I think I got that from the .NET side of things over there... They have a whole intermediate language over there between what the C\# compiler is producing, if I remember...
**Keith Randall:** Yeah, I believe it's like Java, they have some sort of bytecode thing, right?
**Bill Kennedy:** Yeah. The SSA is really interesting, I was just always curious if it came before or after the assembler, or somewhere in between.
**Keith Randall:** Yeah, so there's no assembler when that Go compiler runs; there's no assembler used.
**Bill Kennedy:** Oh, okay.
**Keith Randall:** The thing that's generated from the compiler is already essentially equivalent to what the assembler produces when it parses assembly.
**Erik St. Martin:** Oh, interesting. So basically there's only a linker after that, right? There's no intermediate assembly stage.
**Keith Randall:** Correct.
**Erik St. Martin:** I think Rob Pike did a talk about that at GopherCon, where he was talking about the fact that there's a shared layer, there is an assembler, and there is the compiler, but there's like an object or some kind of library that's used between the two.
**Keith Randall:** Right.