Thanks for looking at this. 

One thing we have to be very careful of here is that this code runs for every 
element in at every step for every pipeline, so it's quite performance 
critical. Running the benchmarks at 
https://github.com/apache/beam/blob/master/sdks/python/apache_beam/tools/map_fn_microbenchmark.py
 (you might need #6293) I see

Before
```
Fixed cost   0.6794422043757005
Per-element  7.113301970741965e-07
R^2          0.9817527457194359
```

After
```
Fixed cost   0.6880206489042804
Per-element  7.551892020485618e-07
R^2          0.9807901397710658
```

which is about a 5% regression. This may be worse if iter(results) is 
expensive. 

Perhaps change the string test to "type(results) is str" and omit the iter(...) 
test as it already gives a more informative `TypeError: 'T' object is not 
iterable` in that case.

[ Full content available at: https://github.com/apache/beam/pull/6242 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to