day2

package
v0.0.0-...-8042dca Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DivePart1

func DivePart1(input string) (_ int, err error)

func DivePart2

func DivePart2(input string) (_ int, err error)

func DivePart2_V2

func DivePart2_V2(input string) (_ int, err error)

DivePart2_V2 is optimized version of DivePart2_V1 for latency. Scanner is quite bad, let's reimplement using IndexByte as in https://felixge.de/2021/12/01/advent-of-go-profiling-2021-day-1-1/.

func DivePart2_V3

func DivePart2_V3(input string) (_ int, err error)

DivePart2_V3 is optimized version of DivePart2_V2 for latency. mallogc GC and int parsing are main offendant. Let's reduce allocs and optimize int parsing. This solution has 0 heap allocs.

func DivePart2_V4

func DivePart2_V4(input string) (_ int, err error)

DivePart2_V4 is optimized version of DivePart2_V3 for latency. IndexByte were main offendants. This is still SLOWER than index Byte. V3 is the fastest.

func DivePart2_V5

func DivePart2_V5(input string) (_ int, err error)

DivePart2_V5 is optimized version of DivePart2_V3 for latency. We can optimize the digit parsing further.

func ReadTestInput

func ReadTestInput(t testing.TB) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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