←back to thread

Show HN: Go Plan9 Memo

(pehringer.info)
302 points pehringer | 1 comments | | HN request time: 0s | source

A quick dive into the Plan9 assembly I picked up while developing my SIMD package for Go, and how it led to a 450% performance boost in calculations.
Show context
saclark11 ◴[] No.41880371[source]
> Overall, pretty weird stuff. I am not sure why the Go team went down this route. Maybe it simplifies the compiler by having this bespoke assembly format?

Rob Pike spoke on the design of Go's assembler at a talk in 2016 [1][2]. I think it basically came down to the observation that most assembly language is roughly the same, so why not build a common assembly language that "lets you talk to the machine at the lowest level and yet not have to learn a new syntax." It also enables them to automatically generate a working assembler given an instruction manual PDF for a new architecture as input.

[1]: https://www.youtube.com/watch?v=KINIAgRpkDA [2]: https://go.dev/talks/2016/asm.slide#1

replies(4): >>41880468 #>>41881654 #>>41884035 #>>41886094 #
alphazard ◴[] No.41880468[source]
And it worked. Go established cross-compilation as table-stakes for new programming languages, at a time when very few were doing it well, if at all.
replies(5): >>41880634 #>>41880798 #>>41883225 #>>41883804 #>>41884968 #
lifthrasiir ◴[] No.41884968[source]
While good cross-compilation is one of Go's strengths... I don't really think a unified assembly language contributed to that? Any assembly code can't be shared across multiple architectures in general, so the only potential benefit would be the easiness of parser development, which doesn't sound like a big thing. Rob Pike himself even noted that it can be offputting to outsiders but considered it's a worthy trade-off nevertheless [1], the conclusion I don't really think justified.

[1] https://go.dev/talks/2016/asm.slide#32

replies(1): >>41888120 #
1. ◴[] No.41888120[source]