@fengyang.wang Thanks for the helpful response. It is good to know that the speed is essentially the same (apart from degenerate cases like the one above). The memory allocation shown in the benchmark appears to be just that needed to hold the function results. But what about the memory of the method definitions and dispatch table? I have seen a few posts (e.g. https://github.com/JuliaLang/julia/issues/7357#issuecomment-277056261, Is mem of compiled/eval'ed functions garbage collected?, and Degrading performance when generating many functions · Issue #18446 · JuliaLang/julia · GitHub) which indicate that defining lots of methods stresses the Julia runtime, with symptoms including high memory use and slightly degraded performance. I am curious as to whether generated functions or compiler specializations would have less overhead since there is (evidently) only one function definition specialized many times, instead of many definitions each specialized once.