beam: Index | Files | Directories

package vet

import ""

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.


Package Files


func Execute Uses

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

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

func NameType Uses

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.

type Eval Uses

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 Uses

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

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

func (*Eval) AllExported Uses

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 Uses

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

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

func (*Eval) Generate Uses

func (e *Eval) Generate(packageName string)

Generate produces a go file under the given package.

func (*Eval) Performant Uses

func (e *Eval) Performant() bool

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

func (*Eval) Print Uses

func (e *Eval) Print(s string)

Print invokes fmt.Fprint on the Eval buffer.

func (*Eval) Printf Uses

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

Printf invokes fmt.Fprintf on the Eval buffer.

func (*Eval) RequiresRegistrations Uses

func (e *Eval) RequiresRegistrations() bool

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

func (*Eval) UsesDefaultReflectionShims Uses

func (e *Eval) UsesDefaultReflectionShims() bool

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


testpipelinePackage testpipeline exports small test pipelines for testing the vet runner.

Package vet imports 16 packages (graph) and is imported by 2 packages. Updated 2021-01-24. Refresh now. Tools for package owners.