6 comments

  • nasretdinov8 hours ago
    Tinygo made a lot of progress over the years -- e.g. they&#x27;ve recently introduced macOS support!<p>It does indeed produce much smaller binaries, including for macOS.<p><pre><code> yuriy@MacBookAir ~&#x2F;t&#x2F;tinygo&gt; 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 ~&#x2F;t&#x2F;tinygo&gt; 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 ~&#x2F;t&#x2F;tinygo&gt; 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 ~&#x2F;t&#x2F;tinygo&gt; cat main.go package main import &quot;fmt&quot; func main() { fmt.Printf(&quot;Hello world!\n&quot;) }</code></pre>
  • carverauto7 hours ago
    We&#x27;re using TinyGo and the Wazero runtime for our WASM plugin system in ServiceRadar, highly recommend both if you&#x27;re using golang.
    • evacchi7 hours ago
      Yay wazero maintainer here, thanks for the shout-out!
      • pancsta5 hours ago
        It was good to meet at wasm.io!
    • apitman7 hours ago
      Wazero is awesome. For anyone wanting to embed in languages other than Go, check out Extism.
  • jackhalford3 hours ago
    Could we compile tailscale with tinygo to run it on openwrt? Last time I checked tailscale was too large for 8MB flash routers
    • mayama33 minutes ago
      Lot of stdlib, especially net, crypto, in tinygo doesn&#x27;t compile, or if compiles has stubs as implementation that panics with not implemented. Few years ago, I tried compiling small terminal http client app and failed at compile stage.<p><a href="https:&#x2F;&#x2F;tinygo.org&#x2F;docs&#x2F;reference&#x2F;lang-support&#x2F;stdlib&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tinygo.org&#x2F;docs&#x2F;reference&#x2F;lang-support&#x2F;stdlib&#x2F;</a>
  • mi_lk6 hours ago
    What are the tradeoffs compared to standard Go?
    • jrockway4 hours ago
      It gets better every release, but there are missing language features:<p><a href="https:&#x2F;&#x2F;tinygo.org&#x2F;docs&#x2F;reference&#x2F;lang-support&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tinygo.org&#x2F;docs&#x2F;reference&#x2F;lang-support&#x2F;</a><p>And parts of the stdlib that don&#x27;t work:<p><a href="https:&#x2F;&#x2F;tinygo.org&#x2F;docs&#x2F;reference&#x2F;lang-support&#x2F;stdlib&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tinygo.org&#x2F;docs&#x2F;reference&#x2F;lang-support&#x2F;stdlib&#x2F;</a>
  • tatjam8 hours ago
    Writing embedded code with an async-aware programming language is wonderful (see Rust&#x27;s embassy), but wonder how competitive this is when you need to push large quantities of data through a micro controller, I presume this is not suitable for real-time stuff?
    • soypat49 minutes ago
      It is more performant than rust but less performant than Zig when not doing GC heavy stuff. <a href="https:&#x2F;&#x2F;github.com&#x2F;tinygo-org&#x2F;tinybench" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tinygo-org&#x2F;tinybench</a>
    • carverauto7 hours ago
      We&#x27;re streaming RSTP camera feeds through WASM plugins and host-bridge adapters, no problem. I was surprised how well it worked TBH.<p><a href="https:&#x2F;&#x2F;code.carverauto.dev&#x2F;carverauto&#x2F;serviceradar&#x2F;src&#x2F;branch&#x2F;staging&#x2F;go&#x2F;cmd&#x2F;wasm-plugins&#x2F;unifi-protect" rel="nofollow">https:&#x2F;&#x2F;code.carverauto.dev&#x2F;carverauto&#x2F;serviceradar&#x2F;src&#x2F;bran...</a>
    • nasretdinov7 hours ago
      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&#x27;t provide realtime guarantees.
      • Groxx5 hours ago
        Doesn&#x27;t seem like those should be mutually exclusive, though the habits involved are quite opposing and I can definitely believe they&#x27;re <i>uncommon</i>.<p>E.g. GC doesn&#x27;t need to be precise. You could reserve CPU budget for GC, and only use that much at a time before yielding control. As long as you still free enough to not OOM, you&#x27;re fine.
    • clktmr7 hours ago
      I&#x27;ve written a fair amount of code for EmbeddedGo. Garbage Collector is not an issue if you avoid heap allocations in your main loop. But if you&#x27;re CPU bound a goroutine might block others from running for quite some time. If your platform supports async preemption, you might be able to patch the goroutine scheduler with realtime capabilities.
    • randusername6 hours ago
      Can you elaborate on this and how it would be different from signaling on interrupts and DMA?<p>Hardware-level async makes sense to me. I can scope it. I can read the data sheet.<p>Software async in contrast seems difficult to characterize and reason about so I&#x27;ve been intimidated.
  • pancsta5 hours ago
    TinyGo doesnt have networking in WASI[0] and the WASM websocket module[1] was last updated 5 years ago. Go without stdlib is not Go.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;tinygo-org&#x2F;tinygo&#x2F;issues&#x2F;4880" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tinygo-org&#x2F;tinygo&#x2F;issues&#x2F;4880</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;Nerzal&#x2F;tinywebsocket" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Nerzal&#x2F;tinywebsocket</a>