unmarshal: replace manual array element copy with reflect.Copy

This commit also adds a benchmark for array unmarshaling. The difference
is staggering.

name                   old time/op    new time/op    delta
LargeArrayUnmarshal-4    23.4µs ± 2%     0.4µs ± 2%  -98.49%  (p=0.000 n=9+9)

name                   old alloc/op   new alloc/op   delta
LargeArrayUnmarshal-4     96.0B ± 0%    128.0B ± 0%  +33.33%  (p=0.000 n=10+10)

name                   old allocs/op  new allocs/op  delta
LargeArrayUnmarshal-4      3.00 ± 0%      4.00 ± 0%  +33.33%  (p=0.000 n=10+10)
2 files changed
tree: a000ad9754676a2904be6c54be2618052ef31199
  1. .github/
  2. cmd/
  3. internal/
  4. testdata/
  5. .gitignore
  6. .gitlab-ci.yml
  7. bplist.go
  8. bplist_generator.go
  9. bplist_parser.go
  10. bplist_test.go
  11. common_data_for_test.go
  12. decode.go
  13. decode_test.go
  14. doc.go
  15. dump_test.go
  16. encode.go
  17. encode_test.go
  18. example_custom_marshaler_test.go
  19. fuzz.go
  20. go.mod
  21. go16_test.go
  22. go17_test.go
  23. invalid_bplist_test.go
  24. invalid_text_test.go
  25. LICENSE
  26. marshal.go
  27. marshal_test.go
  28. must.go
  29. plist.go
  30. plist_types.go
  31. README.md
  32. text_generator.go
  33. text_parser.go
  34. text_tables.go
  35. text_test.go
  36. typeinfo.go
  37. unmarshal.go
  38. unmarshal_test.go
  39. util.go
  40. xml_generator.go
  41. xml_parser.go
  42. xml_test.go
  43. zerocopy.go
  44. zerocopy_appengine.go
README.md

plist - A pure Go property list transcoder coverage report

INSTALL

$ go get howett.net/plist

FEATURES

  • Supports encoding/decoding property lists (Apple XML, Apple Binary, OpenStep and GNUStep) from/to arbitrary Go types

USE

package main
import (
	"howett.net/plist"
	"os"
)
func main() {
	encoder := plist.NewEncoder(os.Stdout)
	encoder.Encode(map[string]string{"hello": "world"})
}