diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index cfdcf6d1e..f85088b08 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -3721,8 +3721,13 @@ void GCodeProcessor::post_process() } auto process_used_filament = [&](std::string& gcode_line) { - auto process_tag = [](std::string& gcode_line, const std::string& tag, const std::vector& values) { - if (boost::algorithm::istarts_with(gcode_line, tag)) { + // Prefilter for parsing speed. + if (gcode_line.size() < 8 || gcode_line[0] != ';' || gcode_line[1] != ' ') + return false; + if (const char c = gcode_line[2]; c != 'f' && c != 't') + return false; + auto process_tag = [](std::string& gcode_line, const std::string_view tag, const std::vector& values) { + if (boost::algorithm::starts_with(gcode_line, tag)) { gcode_line = tag; char buf[1024]; for (size_t i = 0; i < values.size(); ++i) { diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 5ab4685bf..7345c73b4 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -544,7 +544,7 @@ bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float const float max_tooltip_width = ImGui::GetFontSize() * 20.0f; // let the label string start with "##" to hide the automatic label from ImGui::SliderFloat() - bool label_visible = !boost::algorithm::istarts_with(label, "##"); + bool label_visible = !boost::algorithm::starts_with(label, "##"); std::string str_label = label_visible ? std::string("##") + std::string(label) : std::string(label); // removes 2nd evenience of "##", if present