vet

package
v2.23.0-RC2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package vet is a Beam runner that "runs" a pipeline by producing generated code to avoid symbol table lookups and reflection in pipeline execution.

This runner isn't necessarily intended to be run by itself. Other runners can use this as a sanity check on whether a given pipeline avoids known performance bottlenecks.

TODO(BEAM-7374): Add usage documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, p *beam.Pipeline) error

Execute evaluates the pipeline on whether it can run without reflection.

func NameType

func NameType(t reflect.Type) string

NameType turns a reflect.Type into a string based on its name. It prefixes Emit or Iter if the function satisfies the constraints of those types.

Types

type Eval

type Eval struct {
	// contains filtered or unexported fields
}

Eval contains and uniquifies the cache of types and things that need to be generated.

func Evaluate

func Evaluate(_ context.Context, p *beam.Pipeline) (*Eval, error)

Evaluate returns an object that can generate necessary shims and inits.

func (*Eval) AllExported

func (e *Eval) AllExported() bool

AllExported returns whether all values in the pipeline are exported, and thus it may be possible to patch the pipeline's package with generated shims. Using exported vs unexported identifiers does not affect pipeline performance but does matter on if the pipeline package can do anything about it.

func (*Eval) Bytes

func (e *Eval) Bytes() []byte

Bytes returns the Eval buffer's bytes for file writing.

func (*Eval) Generate

func (e *Eval) Generate(packageName string)

Generate produces a go file under the given package.

func (*Eval) Performant

func (e *Eval) Performant() bool

Performant returns whether this pipeline needs additional registrations to avoid reflection, or symbol lookups at runtime.

func (*Eval) Print

func (e *Eval) Print(s string)

Print invokes fmt.Fprint on the Eval buffer.

func (*Eval) Printf

func (e *Eval) Printf(f string, args ...interface{})

Printf invokes fmt.Fprintf on the Eval buffer.

func (*Eval) RequiresRegistrations

func (e *Eval) RequiresRegistrations() bool

RequiresRegistrations returns if there are any types or functions that require registrations.

func (*Eval) UsesDefaultReflectionShims

func (e *Eval) UsesDefaultReflectionShims() bool

UsesDefaultReflectionShims returns whether the default reflection shims are going to be used by the pipeline.

Directories

Path Synopsis
Package testpipeline exports small test pipelines for testing the vet runner.
Package testpipeline exports small test pipelines for testing the vet runner.

Jump to

Keyboard shortcuts

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