Skip to content

Instantly share code, notes, and snippets.

View mdempsky's full-sized avatar

Matthew Dempsky mdempsky

  • San Francisco, CA
  • 08:42 (UTC -07:00)
View GitHub Profile
* Go notes
To fit into Go's current package-oriented compilation mode, we can
define a set of top-down root entry-points into each package.
Any global variable initializations and init functions are always part
of the root.
For package main, the main function is also a root.
@mdempsky
mdempsky / report.md
Last active June 18, 2021 03:57
experience report: runtime: misunderstood Frames.Next documentation

I'm adding a feature to the Go compiler to make debugging it easier. That is, debugging of the Go compiler itself, not of end-user code. (I believe further details are irrelevant, but for concreteness this is CL 328909.)

This feature captures a lot of stack traces, but the expected number of unique frames across all traces is modest. For performance, I expected I would want to use runtime.Callers, and then manually process and memoize the uintptr values. I haven't had a need for runtime.Callers

@mdempsky
mdempsky / init.el
Created January 9, 2021 06:45
emacs config
;; Performance suggestions from
;; https://emacs-lsp.github.io/lsp-mode/page/performance/
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024)) ;; 1mb
(tool-bar-mode -1)
(menu-bar-mode -1)
(require 'package)
#!/bin/sh -e
remote=kyuubi
path=wd/go
# Make a snapshot commit of the current working tree.
git add -u
index=$(git write-tree)
commit=$(git commit-tree $index -p HEAD -m "gotry checkpoint")
package main
import (
"fmt"
"sort"
advent "github.com/mdempsky/advent2020"
)
func main() {
// +build ignore
package main
import (
"bytes"
"fmt"
"go/format"
"go/types"
"io/ioutil"
Language features to prototype
unsafe.Add, unsafe.Slice
Allow anything to be convertible to boolean type (zero value maps to false; non-zero maps to true)
Generalize && and || to non-boolean types (TODO: find golang proposal for this)
Ternary operator ?: (golang.org/issue/33171, and others)
Safe navigation operator ?. (golang.org/issue/42847)
Making nil a universal zero value (golang.org/issue/35966)
- Allow T() as zero value for T? Or only allow nil to be explicitly converted to arbitrary types like T(nil)?
Make T(v) addressable (golang.org/issue/9097)
One of the new features in WPA3 is 256-bit AES.
E.g., see https://apps.nsa.gov/iaarchive/library/reports/wpa3-will-enhance-wi-fi-security.cfm
I'd like to enable this on my home network, which uses two Archer A7s.
(These are basically rebranded Archer C7 v5s, which Amazon was selling at a discount.)
The Archer A7 uses the "qca988x hw2.0" chipset,
which is supported by Linux's ath10k driver:
https://github.com/torvalds/linux/tree/master/drivers/net/wireless/ath/ath10k
### Keybase proof
I hereby claim:
* I am mdempsky on github.
* I am mdempsky (https://keybase.io/mdempsky) on keybase.
* I have a public key ASD01SJVmVpvKqm1YT7Wjm3gxbKkc-pNR81jfLapyMzr6go
To claim this, I am signing this object:
$ go tool compile -m r.go | grep -e leaking -e new.int
r.go:4:12: leaking param: f to result ~r1 level=1
r.go:10:10: new(int) escapes to heap
r.go:26:10: F2 new(int) does not escape
$ cat r.go
package p
//go:noinline