FAAS in Go with WASM, WASI and Rust
https://eli.thegreenplace.net/2023/faas-in-go-with-wasm-wasi-and-rust/ [eli.thegreenplace.net]
2023-05-11 21:07
tags:
go
programming
rust
wasm
web
This post is best described as a technology demonstration; it melds together web servers, plugins, WebAssembly, Go, Rust and ABIs. Here’s what it shows:
How to load WASM code with WASI in a Go environment and hook it up to a web server.
How to implement web server plugins in any language that can be compiled to WASM.
How to translate Go programs into WASM that uses WASI.
How to translate Rust programs into WASM that uses WASI.
How to write WAT (WebAssembly Text) code that uses WASI to interact with a non-JS environment.
source: L
A Cryptographic Near Miss
https://words.filippo.io/dispatches/near-miss/ [words.filippo.io]
2023-04-11 20:00
tags:
bugfix
crypto
go
math
security
Go 1.20.2 fixed a small vulnerability in the crypto/elliptic package. The impact was minor, to the point that I don’t think any application was impacted, but the issue was interesting to look at as a near-miss, and to learn from.
source: L
gotraceui - an efficient frontend for Go execution traces
https://github.com/dominikh/gotraceui [github.com]
2023-03-31 02:29
tags:
development
go
perf
swtools
Gotraceui is a tool for visualizing and analyzing Go execution traces. It is meant to be a faster, more accessible, and more powerful alternative to go tool trace. Unlike go tool trace, Gotraceui doesn’t use deprecated browser APIs (or a browser at all), and its UI is tuned specifically to the unique characteristics of Go traces.
source: L
Go 1.20 Cryptography
https://words.filippo.io/dispatches/go-1-20-cryptography/ [words.filippo.io]
2023-01-27 18:34
tags:
crypto
go
security
update
I’m pretty happy with the work that’s landing in it. There are both exciting new APIs, and invisible deep backend improvements that are going to make code more maintainable and secure in the long run. All the main work mentioned in the planning post got done, and then some (but not the “stretch goals”).
crypto/ecdh
bigmod replaces math/big
More elliptic curves
TLS and X.509
Safer Enums in Go
https://npf.io/2022/05/safer-enums/ [npf.io]
2022-05-14 00:14
tags:
go
programming
There’s no size difference between a string and a struct{ string } and it’s just as easy to read as a straight string. Because of the String() method, you can pass these values to %s etc in format strings and they’ll print out the name with no extra code or work.
source: L
Experience Report: 6 months of Go
https://typesanitizer.com/blog/go-experience-report.html [typesanitizer.com]
2022-04-30 18:53
tags:
go
programming
During this time, I’ve been making notes of speed bumps I’ve run into, as well as things I’ve liked about Go. This post is an expanded version of those notes. I’ve tried my best to keep away from abstract examples, and focus on actual things I’ve run into myself.
source: HN
Generics can make your Go code slower
https://planetscale.com/blog/generics-can-make-your-go-code-slower [planetscale.com]
2022-03-30 18:46
tags:
article
compiler
go
perf
programming
type-system
Go 1.18 is here, and with it, the first release of the long-awaited implementation of Generics is finally ready for production usage. Generics are a frequently requested feature that has been highly contentious throughout the Go community. On the one side, vocal detractors worry about the added complexity. They fear the inescapable evolution of Go towards either a verbose and Enterprisey Java-lite with Generic Factories or, most terrifyingly, a degenerate HaskellScript that replaces ifs with Monads. In all fairness, both these fears may be overblown. On the other side, proponents of generics believe that they are a critical feature to implement clean and reusable code at scale.
This blog post does not take sides in that debate, or advise where and when to use Generics in Go. Instead, this blog post is about the third side of the generics conundrum: It’s about systems engineers who are not excited about generics per se, but about monomorphization and its performance implications. There are dozens of us! Dozens! And we’re all due for some serious disappointment.
Very thorough.
source: HN
How does Go know time.Now?
https://tpaschalis.github.io/golang-time-now/ [tpaschalis.github.io]
2021-04-01 00:29
tags:
go
investigation
programming
systems
This post may be a little longer than usual, so grab your coffees, grab your teas and without further ado, let’s dive in and see what we can come up with.
source: L
SSH and User-mode IP WireGuard
https://fly.io/blog/ssh-and-user-mode-ip-wireguard/ [fly.io]
2021-03-12 03:23
tags:
admin
cloud
development
go
library
networking
For a couple hundred lines of code (not counting the entire user-mode Linux you’ll be pulling in from gVisor, HEY! Dependencies! What are you gonna do!) you can bring up a new, cryptographically authenticated network, any time you want to, in practically any program.
There really are some fun libraries out there if you want to build something crazy.
source: HN
Block Profiling in Go
https://github.com/felixge/go-profiler-notes/blob/main/block.md [github.com]
2021-02-10 01:46
tags:
benchmark
development
go
perf
The block profile in Go lets you analyze how much time your program spends waiting on the blocking operations listed below:
source: HN
Unsafe string interning in Go
https://mdlayher.com/blog/unsafe-string-interning-in-go/ [mdlayher.com]
2020-12-30 22:50
tags:
garbage-collection
go
programming
The result of this work is the package go4.org/intern which uses some pretty neat unsafe tricks to implement efficient string interning using weak references and Go finalizers. We’ll start by showing off the safe implementation and gradually introduce the concepts needed to understand the unsafe one as well.
source: L
An interesting mistake with Go's context package that I (sort of) made
https://utcc.utoronto.ca/~cks/space/blog/programming/GoContextValueMistake [utcc.utoronto.ca]
2020-08-30 16:29
tags:
go
intro-programming
I didn’t answer this correctly because I focused my attention on the wrong thing.
source: HN
Implementing traceroute in Go
https://blog.kalbhor.xyz/post/implementing-traceroute-in-go/ [blog.kalbhor.xyz]
2020-08-24 17:45
tags:
go
networking
programming
This tool is very useful to inspect network paths and solve problems. But aside from that, this tool is extremely interesting and its actual implementation is pretty simple.
source: L
How Go 1.15 improved converting small integer values to interfaces
https://utcc.utoronto.ca/~cks/space/blog/programming/Go115InterfaceSmallInts [utcc.utoronto.ca]
2020-08-17 04:31
tags:
go
perf
programming
The answer turns out to be pretty straightforward, and is in Go CL 216401 (merged in this commit, which may be easier to read). The Go runtime has a special static array of the first 256 integers (0 to 255), and when it would normally have to allocate memory to store an integer on the heap as part of converting it to an interface, it first checks to see if it can just return a pointer to the appropriate element in the array instead. This kind of static allocation of frequently used values is common in languages with lots of dynamic allocation; Python does something similar for small integers, for example (which can sometimes surprise you).
source: L
Proposal: Register-based Go calling convention
https://go.googlesource.com/proposal/+/refs/changes/78/248178/1/design/40724-register-calling.md [go.googlesource.com]
2020-08-17 04:29
tags:
compiler
cpu
go
programming
We propose switching the Go ABI from its current stack-based calling convention to a register-based calling convention. Preliminary experiments indicate this will achieve at least a 5–10% throughput improvement across a range of applications. This will remain backwards compatible with existing assembly code that assumes Go’s current stack-based calling convention through Go’s multiple ABI mechanism.
This also presents a very nice overview of existing calling conventions.
source: L
Let's build a Full-Text Search engine
https://artem.krylysov.com/blog/2020/07/28/lets-build-a-full-text-search-engine/ [artem.krylysov.com]
2020-07-30 16:48
tags:
go
intro-programming
text
Today we are going to build our own FTS engine. By the end of this post, we’ll be able to search across millions of documents in less than a millisecond. We’ll start with simple search queries like “give me all documents that contain the word cat” and we’ll extend the engine to support more sophisticated boolean queries.
source: L
Using Go build directives to optionally use new APIs in the standard library
https://utcc.utoronto.ca/~cks/space/blog/programming/GoBuildUsingNewAPIs [utcc.utoronto.ca]
2020-07-19 06:42
tags:
go
intro-programming
library
I mentioned recently that new APIs in the Go standard library were relatively easy to optionally support, because such new APIs only appear in new Go releases and you can conditionally build files based on the Go release that’s building your program. But that’s a pretty abstract description, so let’s make it concrete.
PopCount on ARM64 in Go Assembler
https://barakmich.dev/posts/popcnt-arm64-go-asm/ [barakmich.dev]
2020-07-13 01:22
tags:
cpu
go
perf
programming
Apropos of Apple’s ARM announcment, I thought I might write up a post on a recent bit of code I wrote that specifically looks at ARM64, and its benchmarks on various hardware. I’ve been implementing some compact data structures for a project. One of the CPU hotspots for the implementation is the need to run a quick population count across a potentially large bit of memory.
source: L
Three bugs in the Go MySQL Driver
https://github.blog/2020-05-20-three-bugs-in-the-go-mysql-driver/ [github.blog]
2020-05-21 06:03
tags:
bugfix
database
go
networking
programming
Adding to this challenge, authzd is deployed to our Kubernetes clusters, where we’ve been experiencing issues with high latencies when opening new TCP connections, something that particularly affects the pooling of connections in the Go MySQL driver. One of the most dangerous lies that programmers tell themselves is that the network is reliable, because, well, most of the time the network is reliable. But when it gets slow or spotty, that’s when things start breaking, and we get to find out the underlying issues in the libraries we take for granted.
Good walkthrough of dealing with some unfriendly bugs.
source: HN
Ensmallening Go binaries by prohibiting comparisons
https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons [dave.cheney.net]
2020-05-09 18:00
tags:
compiler
go
programming
In this post I’ll dig into what equality, in the context of a Go program, means and why changes like this have a measurable impact on the size of a Go program.
Addendum: thanks to Brad’s prodding, Go 1.15 already has a bunch of improvements by Cherry Zhang and Keith Randall that fix the most egregious of the failures to eliminate unnecessary equality and hash functions (although I suspect it was also to avoid the proliferation of this class of CLs).