dns/dnsmessage: add AppendPack method to Message

Add an AppendPack method to Message that appends the message data into a
byte buffer. Reusing a buffer allows for a reduction in allocations.

name          time/op
Pack-8        5.04µs ± 1%
AppendPack-8  4.95µs ± 2%

name          alloc/op
Pack-8        6.22kB ± 0%
AppendPack-8  5.71kB ± 0%

name          allocs/op
Pack-8          21.0 ± 0%
AppendPack-8    20.0 ± 0%

Change-Id: I8bb6b07787cf2ba9ef32e1e60a3003a585ec55be
Reviewed-on: https://go-review.googlesource.com/45274
Reviewed-by: Ian Gudger <igudger@google.com>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2 files changed
tree: ccdf9559149fc9c603cda407548f794764d31ff2
  1. bpf/
  2. context/
  3. dict/
  4. dns/
  5. html/
  6. http2/
  7. icmp/
  8. idna/
  9. internal/
  10. ipv4/
  11. ipv6/
  12. lex/
  13. lif/
  14. nettest/
  15. netutil/
  16. proxy/
  17. publicsuffix/
  18. route/
  19. trace/
  20. webdav/
  21. websocket/
  22. xsrftoken/
  23. .gitattributes
  24. .gitignore
  25. AUTHORS
  26. codereview.cfg
  27. CONTRIBUTING.md
  28. CONTRIBUTORS
  29. LICENSE
  30. PATENTS
  31. README.md
README.md

Go Networking

This repository holds supplementary Go networking libraries.

Download/Install

The easiest way to install is to run go get -u golang.org/x/net. You can also manually git clone the repository to $GOPATH/src/golang.org/x/net.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html. The main issue tracker for the net repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/net:” in the subject line, so it is easy to find.