diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-01-20 23:55:25 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-01-20 23:55:25 +0100 |
| commit | a7e4a49fae26bf52b4b8f26aeebc50d947dc1abc (patch) | |
| tree | 03ccdac553f003b5b389587ebb5a74d4b8091865 /prog/encoding.go | |
| parent | a8632569bf8339f5fa468f99493d4d825db2cb12 (diff) | |
all: spot optimizations
A bunch of spot optmizations after cpu/memory profiling:
1. Optimize hot-path coverage comparison in fuzzer.
2. Don't allocate and copy serialized program, serialize directly into shmem.
3. Reduce allocations during parsing of output shmem (encoding/binary sucks).
4. Don't allocate and copy coverage arrays, refer directly to the shmem region
(we are not going to mutate them).
5. Don't validate programs outside of tests, validation allocates tons of memory.
6. Replace the choose primitive with simpler switches.
Choose allocates fullload of memory (for int, func, and everything the func refers).
7. Other minor optimizations.
Diffstat (limited to 'prog/encoding.go')
| -rw-r--r-- | prog/encoding.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/prog/encoding.go b/prog/encoding.go index b04f667ba..8c7c1674a 100644 --- a/prog/encoding.go +++ b/prog/encoding.go @@ -27,11 +27,9 @@ func (p *Prog) String() string { } func (p *Prog) Serialize() []byte { - /* - if err := p.validate(); err != nil { - panic("serializing invalid program") - } - */ + if err := p.validate(); err != nil { + panic("serializing invalid program") + } buf := new(bytes.Buffer) vars := make(map[*Arg]int) varSeq := 0 |
