News for hackers. Stuff that matters.

chris6f

Re:Durable Coroutines for Go on Friday October 20, 2023 @06:25PM (#37962178)
It's probably better to let the user/application decide what to do in these cases, and for this reason we allow them to register type-specific (de)serialization routines.

In the case of network connections, the user could instead serialize connection details and then recreate the connection when deserializing the coroutine state. Same thing for files, where instead of serializing unstable low-level details like the file descriptor, the user can instead serialize higher level information (path, open flags, etc) and recreate the open file when deserializing the coroutine state.

Re:Durable Coroutines for Go on Friday October 20, 2023 @04:40PM (#37961238)
It's a good point, but the entire program would have to be written this way (you can't use the standard library, or any other dependencies).

What if there were tools to inspect and debug the coroutine state? That's an area we're exploring now.

Re:Durable Coroutines for Go on Friday October 20, 2023 @04:14PM (#37960971)
The library provides a way to serialize coroutine state, and to later deserialize that state and resume a coroutine from its last yield point. Where you store this state (in a DB, in a queue, etc) is up to you!
Re:Durable Coroutines for Go on Friday October 20, 2023 @04:03PM (#37960864)
A source-to-source compiler, and a library that copies runtime implementation details, was the path of least resistance. We'd love to integrate this with the Go compiler (`go build -durable`, vs. `coroc && go build -tags durable`), but the compiler is closed and maintaining a fork of Go would be difficult.
Re:Durable Coroutines for Go on Friday October 20, 2023 @04:02PM (#37960842)
We have a solution already, and we're exploring a few more.

The durable coroutine library is one part of a larger system we're releasing soon. See https://stealthrocket.tech/blog/fairy-tales-of-workflow-orch... for more information :)

Show HN: WebAssembly System Interface (WASI) with Sockets for Go

https://github.com/stealthrocket/wasi-go

Go v1.21, scheduled for release in August 2023, adds experimental support for the WebAssembly System Interface (WASI). It'll be possible to natively compile server-side WebAssembly applications with Go, making Go a first-class citizen along with C/C++, Rust and Zig. GOOS=wasip1 GOARCH=wasm go build ... WASI is still in preview and is missing some key features, e.g. the ability to create...

( Read More... | no comments | 4 points | on HN )
Vector length agnostic programming has its own share of problems. I'm not familiar with the RISC-V V extension, but I assume it's similar to ARM's SVE. There's a good critical look at SVE and VLA here: https://gist.github.com/zingaburga/805669eb891c820bd220418ee...
Re:Quickly checking that a string belongs to a small set on Friday December 30, 2022 @06:13PM (#34191260)
We took a similar approach in our JSON decoder. We needed to support sets (JSON object keys) that aren't necessarily known until runtime, and strings that are up to 16 bytes in length.

We got better performance with a linear scan and SIMD matching than with a hash table or a perfect hashing scheme.

See https://github.com/segmentio/asm/pull/57 (AMD64) and https://github.com/segmentio/asm/pull/65 (ARM64). Here's how it's used in the JSON decoder: https://github.com/segmentio/encoding/pull/101