Skip to content

Commit

Permalink
stacktrace: break instead of continue in for statement
Browse files Browse the repository at this point in the history
break the for loop during dump stack instead of continue for performance

Signed-off-by: Bojun Seo <[email protected]>
  • Loading branch information
Bojun-Seo authored and honggyukim committed Mar 10, 2023
1 parent fc76620 commit c6ebc80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stacktrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ static void print_dump_stackmap(std::vector<std::pair<stack_trace_t, stack_info_
const stack_info_t& info = sorted_stack[i].second;

if (i >= opts.top)
continue;
break;

const stack_trace_t& stack_trace = sorted_stack[i].first;
std::string age = get_delta_time_unit(current - info.birth_time);
Expand Down Expand Up @@ -315,7 +315,7 @@ static void print_dump_stackmap_flamegraph(std::vector<std::pair<stack_trace_t,
const char *semicolon = "";

if (i >= opts.top)
continue;
break;

const stack_trace_t& stack_trace = sorted_stack[i].first;

Expand Down

0 comments on commit c6ebc80

Please sign in to comment.