[Eager] In default_runner, avoid unnecessary copy of the closure to be run.
This change fixes a ClangTidy warning in kernel_and_device.cc. However, the runner is almost always non-null, so the performance impact of this change is likely to be negligible.
PiperOrigin-RevId: 288128926
Change-Id: I9f5f5f22ddd9bb9e5e98fa90e641cb62b1cf0995
diff --git a/tensorflow/core/common_runtime/eager/kernel_and_device.cc b/tensorflow/core/common_runtime/eager/kernel_and_device.cc
index cb5156e..b1a27ae 100644
--- a/tensorflow/core/common_runtime/eager/kernel_and_device.cc
+++ b/tensorflow/core/common_runtime/eager/kernel_and_device.cc
@@ -74,7 +74,7 @@
} else {
static auto* default_runner =
new std::function<void(std::function<void()>)>(
- [](std::function<void()> f) { f(); });
+ [](const std::function<void()>& f) { f(); });
return default_runner;
}
}