| 824 | } |
| 825 | |
| 826 | func BenchmarkTenFunctions(b *testing.B) { |
| 827 | ctx := context.Background() |
| 828 | |
| 829 | for i := 0; i < b.N; i++ { |
| 830 | p := pipe.New() |
| 831 | p.Add( |
| 832 | pipe.Println("hello world"), |
| 833 | pipe.Function("copy1", catFn), |
| 834 | pipe.Function("copy2", catFn), |
| 835 | pipe.Function("copy3", catFn), |
| 836 | pipe.Function("copy4", catFn), |
| 837 | pipe.Function("copy5", catFn), |
| 838 | pipe.Function("copy6", catFn), |
| 839 | pipe.Function("copy7", catFn), |
| 840 | pipe.Function("copy8", catFn), |
| 841 | pipe.Function("copy9", catFn), |
| 842 | ) |
| 843 | out, err := p.Output(ctx) |
| 844 | if assert.NoError(b, err) { |
| 845 | assert.EqualValues(b, "hello world\n", out) |
| 846 | } |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | func BenchmarkTenMixedStages(b *testing.B) { |
| 851 | ctx := context.Background() |