arraysstruct

package
v0.0.0-...-b91b1e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2019 License: BSD-2-Clause Imports: 1 Imported by: 0

README

Data in multiple arrays

You need to maintain related data using an ordinary string key:

  • Each array contains one data of one set
  • Array of struct
  • Map using the key to access the struct

src>go test -bench=. ./arraysstruct

Results

Arrays are slightly faster. Performance of an array of struct is similar with the advantage of stronger typing. The map is 30% more expensive.

go version go12 windows/amd64

BenchmarkArrays-4                5000000               285 ns/op
BenchmarkArrayStructs-4          5000000               300 ns/op
BenchmarkMapStructs-4            3000000               413 ns/op
PASS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayStructs

func ArrayStructs() string

func Arrays

func Arrays() string

func MapStructs

func MapStructs() string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL