Blazingly Fast Shadow Stacks for Go
https://blog.felixge.de/blazingly-fast-shadow-stacks-for-go/ [blog.felixge.de]
2024-05-30 07:32
tags:
compiler
go
perf
programming
Software shadow stacks could deliver up to 8x faster stack trace capturing in the Go runtime when compared to the frame pointer unwinding that landed in go1.21. This doesn’t mean that this idea should escape from the laboratory right away, but it offers a fun glimpse into a potential future of hardware accelerated stack trace capturing via shadow stacks.
source: HN
Runtime code generation and execution in Go
https://mathetake.github.io/posts/runtime-code-generation-in-go-part-1/ [mathetake.github.io]
2024-05-29 21:26
tags:
go
jit
programming
wazero is an extremely unique and rare piece of production software out there in the Go ecosystem in the sense that it generates semantically equivalent x86-64 and AArch64 machine code from WebAssembly bytecode at runtime, and then provides the API to execute and interact with it with zero dependency, hence without CGo.
This post is decoupled from wazero itself, and I’ll focus on the general concept of runtime code generation and execution in Go.
source: HN
Secure Randomness in Go 1.22
https://go.dev/blog/chacha8rand [go.dev]
2024-05-07 06:15
tags:
development
go
programming
random
security
update
Computers aren’t random. On the contrary, hardware designers work very hard to make sure computers run every program the same way every time. So when a program does need random numbers, that requires extra effort. Traditionally, computer scientists and programming languages have distinguished between two different kinds of random numbers: statistical and cryptographic randomness. In Go, those are provided by math/rand and crypto/rand, respectively. This post is about how Go 1.22 brings the two closer together, by using a cryptographic random number source in math/rand (as well as math/rand/v2, as mentioned in our previous post). The result is better randomness and far less damage when developers accidentally use math/rand instead of crypto/rand.
source: HN
Initializing Large Static Maps in Go
https://www.dolthub.com/blog/2023-06-16-static-map-initialization-in-go/ [www.dolthub.com]
2023-06-17 01:50
tags:
go
programming
This article discusses the technical details of static initialization for map data in Go binaries, and some alternative strategies for dealing with the performance impacts.
source: L
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