sdf

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 2 Imported by: 2

README

sequential-data-flow

High performance sequential data processing.

Benchmark

Here is result of benchmark with parsing JSON string:

go test -bench=. .
goos: darwin
goarch: amd64
pkg: github.com/BrobridgeOrg/sequential-data-flow
BenchmarkBaseline/Small-16                  	  743193	      1432 ns/op
BenchmarkBaseline/Large-16                  	   10000	    105195 ns/op
BenchmarkLowBufferSize/Small-16             	 1582555	       738 ns/op
BenchmarkLowBufferSize/Large-16             	   21139	     58260 ns/op
BenchmarkHighBufferSize/Small-16            	 1616371	       878 ns/op
BenchmarkHighBufferSize/Large-16            	   36951	     47298 ns/op
BenchmarkHighWorkerCount/Small-16           	 1941549	       717 ns/op
BenchmarkHighWorkerCount/Large-16           	   52912	     29032 ns/op
BenchmarkHighBufferSizeAndWorkerCount/Small-16         	 1267849	      1035 ns/op
BenchmarkHighBufferSizeAndWorkerCount/Large-16         	   41293	     38983 ns/op
PASS
ok  	github.com/BrobridgeOrg/sequential-data-flow	68.936s

License

Licensed under the Apache License

Authors

Copyright(c) 2021 Fred Chien fred@brobridge.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flow

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

func NewFlow

func NewFlow(options *Options) *Flow

func (*Flow) Close

func (f *Flow) Close()

func (*Flow) Output

func (f *Flow) Output() chan interface{}

func (*Flow) Push

func (f *Flow) Push(data interface{})

type Options

type Options struct {
	BufferSize  int
	WorkerCount int
	Handler     func(interface{}, func(interface{}))
}

func NewOptions

func NewOptions() *Options

type Task

type Task struct {
	Flow      *Flow
	Payload   interface{}
	Completed bool
	ID        int
	// contains filtered or unexported fields
}

func NewTask

func NewTask(flow *Flow) *Task

func (*Task) Available

func (t *Task) Available()

func (*Task) Done

func (t *Task) Done(result interface{})

func (*Task) Release

func (t *Task) Release()

func (*Task) Reset

func (t *Task) Reset()

func (*Task) Wait

func (t *Task) Wait()

Jump to

Keyboard shortcuts

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