From f7462336c22c40159dd1ebbca1e1154a91abe0b2 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 27 Jun 2018 14:33:11 -0700 Subject: [PATCH] Created AssemblyPolicy (markdown) --- AssemblyPolicy.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 AssemblyPolicy.md diff --git a/AssemblyPolicy.md b/AssemblyPolicy.md new file mode 100644 index 00000000..f3f3e3d7 --- /dev/null +++ b/AssemblyPolicy.md @@ -0,0 +1,17 @@ +# Assembly Policy + +This document describes when and how to add assembly code to routines in the Go-maintained packages. + +In general, the rules are: + +* we prefer portable Go, not assembly. Code in assembly means (N packages * M architectures) to maintain, rather than just N packages. + +* assembly code needs benchmarks showing it's worth it + +* minimize use of assembly. We'd rather have a small amount of assembly for a 50% speedup rather than twice as much assembly for a 55% speedup. + +* make your assembly easy to review, and ideally auto-generated from a Go program so we can review the generator program. Comment it well. + +* test it well. The bar for new assembly code is high. It needs commensurate test coverage. + +*TODO*: add more. This document is a work in progress. \ No newline at end of file