BENCH makeslice optimization.
BENCH makeslice optimization.

runtime.makeslice was taking up 8.5% of our CPU, and most of it was rooted in
NewPacket.  Since layers is the only slice created in NewPacket, it seemed at
fault.  Creating an initial array of layers in the packet and pointing the
layers slice there seems to have helped greatly, as it means the slice space is
created with the packet allocation and doesn't require another allocation call.

----------------------------------------------------------
BENCHMARK_MARKER_DO_NOT_CHANGE
----------------------------------------------------------

TEST BENCHMARKS
testing: warning: no tests to run
PASS
BenchmarkTypeAssertion	500000000	         3.45 ns/op
BenchmarkMapLookup	50000000	        43.2 ns/op
BenchmarkNilMapLookup	100000000	        20.6 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.80 ns/op
BenchmarkArrayLookup	2000000000	         0.53 ns/op
BenchmarkTypeToInterface1	2000000000	         0.80 ns/op
BenchmarkTypeToInterface2	2000000000	         0.53 ns/op
BenchmarkCheckEthernetPrefix	50000000	        36.2 ns/op
ok  	github.com/gconnell/gopacket	13.860s
PASS
BenchmarkLayerClassSliceContains	2000000000	         1.33 ns/op
BenchmarkLayerClassMapContains	50000000	        49.9 ns/op
BenchmarkLazyNoCopyEthLayer	 1000000	      1665 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1664 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      1669 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      1658 ns/op
BenchmarkDefault	 1000000	      1745 ns/op
BenchmarkLazy	 1000000	      2010 ns/op
BenchmarkNoCopy	 1000000	      1387 ns/op
BenchmarkLazyNoCopy	 1000000	      1653 ns/op
BenchmarkAlloc	10000000	       178 ns/op
BenchmarkFlow	10000000	       200 ns/op
BenchmarkEndpoints	100000000	        28.1 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        11.6 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        72.2 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	1000000000	         2.81 ns/op
BenchmarkDecodePacketIPSecESP	 2000000	       934 ns/op
ok  	github.com/gconnell/gopacket/layers	36.800s
?   	github.com/gconnell/gopacket/pcap	[no test files]
?   	github.com/gconnell/gopacket/pfring	[no test files]

PCAP BENCHMARK
Reading file once through to hopefully cache most of it
Read in file /tmp/gopacket_benchmark.pcap , total of 341401548 bytes
Opening file "/tmp/gopacket_benchmark.pcap" for read
Reading all packets into memory with BufferPacketSource.
Reading packet data into memory: 1237119 packets in 901.895498ms, 729ns per packet
Time to read packet data into memory from file: 901.923705ms
Benchmarking decode 1/10
	Read in 1237119 packets in 1.58941677s, 1.284us per packet
Benchmarking decode 2/10
	Read in 1237119 packets in 1.522482121s, 1.23us per packet
Benchmarking decode 3/10
	Read in 1237119 packets in 1.555832669s, 1.257us per packet
Benchmarking decode 4/10
	Read in 1237119 packets in 1.57305841s, 1.271us per packet
Benchmarking decode 5/10
	Read in 1237119 packets in 1.727420366s, 1.396us per packet
Benchmarking decode 6/10
	Read in 1237119 packets in 1.581368701s, 1.278us per packet
Benchmarking decode 7/10
	Read in 1237119 packets in 1.580800632s, 1.277us per packet
Benchmarking decode 8/10
	Read in 1237119 packets in 1.579536878s, 1.276us per packet
Benchmarking decode 9/10
	Read in 1237119 packets in 1.578491853s, 1.275us per packet
Benchmarking decode 10/10
	Read in 1237119 packets in 1.578995458s, 1.276us per packet
----------------------------------------------------------
BENCHMARKING AGAINST COMMIT 6fade526006f608e559fe74f66a5422360b4760b
----------------------------------------------------------

OLD TEST BENCHMARKS
?   	github.com/gconnell/gopacket	[no test files]
If you see a crash here, it's serious business.  Report it!
Send this number with any crash reports: 1356127228261920300
No crash to see here... continuing with testing
PASS
BenchmarkTypeAssertion	500000000	         3.71 ns/op
BenchmarkMapLookup	50000000	        36.1 ns/op
BenchmarkNilMapLookup	200000000	         7.48 ns/op
BenchmarkNilMapLookupWithNilCheck	2000000000	         0.79 ns/op
BenchmarkArrayLookup	2000000000	         0.53 ns/op
BenchmarkLayerClassSliceContains	2000000000	         1.33 ns/op
BenchmarkLayerClassMapContains	50000000	        43.0 ns/op
BenchmarkLazyNoCopyEthLayer	 5000000	       629 ns/op
BenchmarkLazyNoCopyIPLayer	 1000000	      1042 ns/op
BenchmarkLazyNoCopyTCPLayer	 1000000	      1698 ns/op
BenchmarkLazyNoCopyAllLayers	 1000000	      1919 ns/op
BenchmarkDefault	 1000000	      1819 ns/op
BenchmarkLazy	 5000000	       662 ns/op
BenchmarkNoCopy	 1000000	      1460 ns/op
BenchmarkLazyNoCopy	 5000000	       314 ns/op
BenchmarkAlloc	10000000	       182 ns/op
BenchmarkFlow	10000000	       201 ns/op
BenchmarkEndpoints	100000000	        28.2 ns/op
BenchmarkTCPLayerFromDecodedPacket	100000000	        11.7 ns/op
BenchmarkTCPLayerClassFromDecodedPacket	50000000	        71.9 ns/op
BenchmarkTCPTransportLayerFromDecodedPacket	1000000000	         2.85 ns/op
BenchmarkCheckEthernetPrefix	50000000	        37.8 ns/op
BenchmarkDecodePacketIPSecESP	 1000000	      1049 ns/op
ok  	github.com/gconnell/gopacket/layers	50.058s
?   	github.com/gconnell/gopacket/pcap	[no test files]
?   	github.com/gconnell/gopacket/pfring	[no test files]

OLD PCAP BENCHMARK
Reading file once through to hopefully cache most of it
Read in file /tmp/gopacket_benchmark.pcap , total of 341401548 bytes
Opening file "/tmp/gopacket_benchmark.pcap" for read
Reading all packets into memory with BufferPacketSource.
Reading packet data into memory: 1237119 packets in 1.057973767s, 855ns per packet
Time to read packet data into memory from file: 1.05800711s
Benchmarking decode 1/10
	Read in 1237119 packets in 2.023001986s, 1.635us per packet
Benchmarking decode 2/10
	Read in 1237119 packets in 1.965206144s, 1.588us per packet
Benchmarking decode 3/10
	Read in 1237119 packets in 2.030603335s, 1.641us per packet
Benchmarking decode 4/10
	Read in 1237119 packets in 2.036982287s, 1.646us per packet
Benchmarking decode 5/10
	Read in 1237119 packets in 2.029370157s, 1.64us per packet
Benchmarking decode 6/10
	Read in 1237119 packets in 2.030986286s, 1.641us per packet
Benchmarking decode 7/10
	Read in 1237119 packets in 2.032052187s, 1.642us per packet
Benchmarking decode 8/10
	Read in 1237119 packets in 2.033401796s, 1.643us per packet
Benchmarking decode 9/10
	Read in 1237119 packets in 2.032463772s, 1.642us per packet
Benchmarking decode 10/10
	Read in 1237119 packets in 2.033587362s, 1.643us per packet

wheelcomplex/gopacket,LrsK/gopacket,nhooyr/gopacket,skyportsystems/gopacket,clarktrimble/gopacket,packetb-old/gopacket,UIKit0/gopacket-1,lokikiller/gopacket,nhooyr/gopacket,lokikiller/gopacket,breml/gopacket,clarktrimble/gopacket,rouzier/gopacket,zerklabs/gopacket,1d4Nf6/gopacket,rouzier/gopacket,hkwi/gopacket,josephcopenhaver/gopacket,dazer-chen/gopacket,google/gopacket,packetbeat/gopacket,dutchcoders/gopacket,levigross/gopacket,vtolstov/gopacket,LrsK/gopacket,aeppert/gopacket,urso/gopacket,aeppert/gopacket,dazer-chen/gopacket,adriantam/gopacket,hkwi/gopacket,aeppert/gopacket,zerklabs/gopacket,vtolstov/gopacket,LrsK/gopacket,levigross/gopacket,josephcopenhaver/gopacket,urso/gopacket,skyportsystems/gopacket,UIKit0/gopacket-1,scroot/gopacket,packetbeat/gopacket,scroot/gopacket,dutchcoders/gopacket,clarktrimble/gopacket,levigross/gopacket,cmillward/gopacket,adriantam/gopacket,cmillward/gopacket,chapayGhub/gopacket,1d4Nf6/gopacket,ross-williams/gopacket,ccordes-snaproute/gopacket,zerklabs/gopacket,skyportsystems/gopacket,hkwi/gopacket,wheelcomplex/gopacket,breml/gopacket,xuzhaokui/gopacket,packetb-old/gopacket,lokikiller/gopacket,rouzier/gopacket,UIKit0/gopacket-1,packetb-old/gopacket,scroot/gopacket,josephcopenhaver/gopacket,dazer-chen/gopacket,breml/gopacket,vtolstov/gopacket,packetb-old/gopacket,packetbeat/gopacket,chapayGhub/gopacket,xuzhaokui/gopacket,dutchcoders/gopacket,ross-williams/gopacket,xuzhaokui/gopacket,adriantam/gopacket,ccordes-snaproute/gopacket,wheelcomplex/gopacket,nhooyr/gopacket,urso/gopacket,ccordes-snaproute/gopacket,ross-williams/gopacket,chapayGhub/gopacket,cmillward/gopacket,packetbeat/gopacket,1d4Nf6/gopacket,google/gopacket,google/gopacket