diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-21 12:51:25 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-21 12:51:25 +0100 |
commit | 26bce7119200f37f8b9f3ddc1a2c76c85f7c88be (patch) | |
tree | 21a2aa762215e2230ba676454828c1497a568cc6 /main/command.go | |
parent | 184118c1522ee4e78a0588fcac8eb235f512b599 (diff) | |
download | stred-go-26bce7119200f37f8b9f3ddc1a2c76c85f7c88be.tar |
Changes the implementation of Atomise and Compound to no longer use goroutines
This results in a massive performance boost, ~4x speedup
Diffstat (limited to 'main/command.go')
-rw-r--r-- | main/command.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/main/command.go b/main/command.go index 9554f9d..136fb26 100644 --- a/main/command.go +++ b/main/command.go @@ -54,19 +54,12 @@ func (cmd DeletePathCommand) exec(state *ProgramState) { } func runSubex(state subex.SubexState, in []walk.WalkValue) (out []walk.WalkValue, error bool) { - valueStream := make(chan walk.WalkValue) - go func(in []walk.WalkValue, out chan<- walk.WalkValue) { - for _, value := range in { - out <- value - } - close(out) - }(in, valueStream) - atomStream := walk.Atomise(valueStream) - atomsOut, error := subex.RunTransducer(state, atomStream) + atomsIn := walk.Atomise(in) + atomsOut, error := subex.RunTransducer(state, atomsIn) if error { return nil, true } - valuesOut, err := walk.MemoryCompound(atomsOut) + valuesOut, err := walk.Compound(atomsOut) if err != nil { return nil, true } |