nasretdinov

0 Followers
0 Following
4 Posts

This account is a replica from Hacker News. Its author can't see your replies. If you find this service useful, please consider supporting us via our Patreon.
Officialhttps://
Support this servicehttps://www.patreon.com/birddotmakeup
I like how most people's reactions at this point are "yeah, whatever", as if it's every day that humans observe the far side of the moon with a naked eye through a window :). We do know what it looks like and we have photos from the surface, yes, but seeing the reaction from real people who're actually there does hit different, at least for me
You can disable GC in tinygo, so if you allocate all the necessary buffers beforehand it can have good performance with real-time characteristics. If you _need_ dynamic memory allocation then no, because you need GC it can't provide realtime guarantees.

Tinygo made a lot of progress over the years -- e.g. they've recently introduced macOS support!

It does indeed produce much smaller binaries, including for macOS.

yuriy@MacBookAir ~/t/tinygo> time tinygo build -o test-tiny main.go

________________________________________________________
Executed in 1.06 secs fish external
usr time 1.18 secs 0.31 millis 1.18 secs
sys time 0.18 secs 1.50 millis 0.18 secs

yuriy@MacBookAir ~/t/tinygo> time go build -o test-normal main.go

________________________________________________________
Executed in 75.79 millis fish external
usr time 64.06 millis 0.41 millis 63.64 millis
sys time 96.76 millis 1.75 millis 95.01 millis

yuriy@MacBookAir ~/t/tinygo> ll
total 5096
-rw-r--r--@ 1 yuriy staff 74B 3 Apr 19:17 main.go
-rwxr-xr-x@ 1 yuriy staff 2.3M 3 Apr 19:18 test-normal*
-rwxr-xr-x@ 1 yuriy staff 192K 3 Apr 19:18 test-tiny*
yuriy@MacBookAir ~/t/tinygo> cat main.go
package main

import "fmt"

func main() {
fmt.Printf("Hello world!\n")
}

Interestingly enough, the initial Go implementation was indeed just a transpiler to C, and generally Go and C are semantically very similar. So the fact that you can even (successfully and relatively easily) do Go->C transpiling isn't entirely surprising. Of course you can't port `go` keyword and GC, but the language that the author is developing (called So) doesn't support these features anyway :).