This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"reflect" | |
"unsafe" | |
) | |
// Safe version to do this. | |
func ReadOnlyChanFromSlice(s []string) <-chan string { | |
c := make(chan string, len(s)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gh issue list --json number,title,body -t "{{range .}} | |
--- | |
## {{.number}} - {{.title}} | |
{{.body}} | |
{{end}}"|sed 's/\r//g' > issues.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package document provides tools for manipulating the structure of TOML | |
// documents. | |
// | |
// While github.com/pelletier/go-toml provides efficient functions to transform | |
// TOML documents to and from usual Go types, this package allows you to create | |
// and modify the structure of a TOML document. | |
// | |
// Comments | |
// | |
// Most structural elements of a Document can have comments attached to them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to generate performance graph for utf8.Valid. | |
# Takes output of go test -bench as stdin. | |
# | |
# make && go test ./utf8 -run=None -bench=BenchmarkValid|tee out.txt | |
# python plot.py < out.txt | |
# open data.png | |
import fileinput | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Go AVO code that generates a right shift cross lanes with zeroes fill when offset is known and less than 16 bytes. | |
Comment("Shift right that works if remaining bytes >= 16") | |
VPMOVQU(Mem{Base: d}, currentBlockY) | |
zeroes := YMM() | |
VPXOR(zeroes, zeroes, zeroes) | |
src1 := YMM() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Display the assembly generated by the Go compiler of the code at current line in an emacs buffer. | |
;; | |
;; Navigate to a line of go code, then M-x my/go-show-asm. | |
(defun my/go-show-asm () | |
(interactive) | |
(let* ((p (buffer-file-name)) | |
(out-b "*go-show-asm*") | |
(needle (concat p ":" (number-to-string (line-number-at-pos))))) | |
(if (string-suffix-p ".go" p) | |
(progn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello, world! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <immintrin.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
const char mask_bytes[] = { | |
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Python script that automates the benchmarking of Go utf8.Valid function over | |
small inputs. | |
This script will clone the Go repository, build the Go toolchain, and run the | |
utf8.Valid benchmarks over small inputs, both on the CL and its parent, and plot | |
the time per operation. | |
Requirements: | |
- Python 3 |
OlderNewer