PhotoFlow optimizations and benchmarks

Thanks @houz! I guess I should look here and the functions being called from there?