From 27e19e51b5d8db60b053a0c5b504343debfeffe1 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Mon, 4 Dec 2023 16:28:54 -0500 Subject: [PATCH] perf: avoid deep string copy --- bindings/cpu_profiler.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/cpu_profiler.cc b/bindings/cpu_profiler.cc index 58c2b50a..56907b86 100644 --- a/bindings/cpu_profiler.cc +++ b/bindings/cpu_profiler.cc @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -47,12 +48,11 @@ v8::CpuProfilingLoggingMode GetLoggingMode() { return kDefaultLoggingMode; } - std::string logging_mode_str(logging_mode); // other times it'll likely be set to lazy as eager is the default - if (logging_mode_str == kLazyLoggingMode) { + if (strcmp(logging_mode, kLazyLoggingMode) == 0) { return v8::CpuProfilingLoggingMode::kLazyLogging; } - else if (logging_mode_str == kEagerLoggingMode) { + else if (strcmp(logging_mode, kEagerLoggingMode) == 0) { return v8::CpuProfilingLoggingMode::kEagerLogging; }