I guess my confusion arises because I mistook the operation of generators based on this comment, understanding generators basically to provide a sugary lazy interface to map
and filter
, and because when writing my_merge_names
using generators as above it was compiled away and ran fast. Yet here in Base.keys(::MyStruct)
the generator does exactly the same thing yet allocates at runtime and runs slow. It seems like a challenge to figure out when or whether a generator will be unrolled by the compiler.