Yes I should have mentioned that they use quite different amounts of memory. But I am still surprised. First of all when I call it with n=17, T is a tiny set (9 elements). Moreover, both are suppose to return a function and the code for that function is identical. So when you run them they presumably should do the exact same thing regardless of the extra code in the exterior function block.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Extra allocations/time when a function is returned from another function than defined directly | 6 | 348 | May 30, 2022 | |
| Inner function overhead | 2 | 698 | February 3, 2019 | |
| Very strange performance issue of a simple code | 4 | 608 | June 16, 2019 | |
| What does it mean to define a function inside a function? Will this result in additional performance overhead? | 6 | 252 | November 8, 2024 | |
| Getting rid of memory allocations in nested functions | 3 | 390 | January 31, 2023 |