Closed LimitlessEarth closed 3 years ago
We process, filter and transform so many packets and uint16s are about 2.55x slower in use.
For just accessing maps of different types: BenchmarkMapUint64Keys-16 292469652 4.549 ns/op BenchmarkMapIntKeys-16 272205794 4.732 ns/op BenchmarkMapUintKeys-16 267450457 4.410 ns/op BenchmarkMapInt16Keys-16 98100704 12.07 ns/op BenchmarkMapUint16Keys-16 92810259 12.22 ns/op
let alone all the converting back and forth we have to do.
I am standardizing pids on ints; they are easier as a default and faster.
or if you want to explore the golang source code: https://github.com/golang/go/blob/dc12d5b0f5e9c1cfec2a8eb6dd7ff3473c36d45c/src/runtime/map_fast32.go#L12 https://github.com/golang/go/blob/dc12d5b0f5e9c1cfec2a8eb6dd7ff3473c36d45c/src/runtime/map_fast64.go#L12
vs https://github.com/golang/go/blob/dc12d5b0f5e9c1cfec2a8eb6dd7ff3473c36d45c/src/runtime/map.go
you will not find a fast mapaccess1_fast16 anywhere.
We process, filter and transform so many packets and uint16s are about 2.55x slower in use.
For just accessing maps of different types: BenchmarkMapUint64Keys-16 292469652 4.549 ns/op BenchmarkMapIntKeys-16 272205794 4.732 ns/op BenchmarkMapUintKeys-16 267450457 4.410 ns/op BenchmarkMapInt16Keys-16 98100704 12.07 ns/op BenchmarkMapUint16Keys-16 92810259 12.22 ns/op
let alone all the converting back and forth we have to do.
I am standardizing pids on ints; they are easier as a default and faster.
or if you want to explore the golang source code: https://github.com/golang/go/blob/dc12d5b0f5e9c1cfec2a8eb6dd7ff3473c36d45c/src/runtime/map_fast32.go#L12 https://github.com/golang/go/blob/dc12d5b0f5e9c1cfec2a8eb6dd7ff3473c36d45c/src/runtime/map_fast64.go#L12
vs https://github.com/golang/go/blob/dc12d5b0f5e9c1cfec2a8eb6dd7ff3473c36d45c/src/runtime/map.go
you will not find a fast mapaccess1_fast16 anywhere.