add a step by step benchmark of the optimizations to the function
event monitor
copy the optimization to the function_memory monitor. This implementation
is 17 times faster in my local machine