I'm working with Earthengine with a commercial license now so I started worrying about the performance of my computations. As the caching mechanism is preventing me from doing performance checks on my own, I'll ask it here and maybe a GEE developer will pass by.
Should I prefer using map
or iterate
when looping on a collection?
sequence = ee.List.sequence(1000)
# map version
featureList = sequence.map(lambda i: ee.Feature(point, {"id": i}))
# iterate
featureList = sequence.iterate(
lambda i, l: ee.List(l).cat(ee.List([ee.Feature(point, {"id": i})])),
ee.List([])
)
In this example, I would of course go for the map
for readability but there are more tricky situations where forcing myself to think with map
is taking more time than a good old iterate
.