Passing by value into lambda slower than passing by reference