Performance improvement of GCodeProcessor:
Replaced std::string with std::string_view for constant parameters Replaced boost:istarts_with() with boost::starts_with()
This commit is contained in:
parent
42b546ae9c
commit
01031779b7
@ -3721,8 +3721,13 @@ void GCodeProcessor::post_process()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto process_used_filament = [&](std::string& gcode_line) {
|
auto process_used_filament = [&](std::string& gcode_line) {
|
||||||
auto process_tag = [](std::string& gcode_line, const std::string& tag, const std::vector<double>& values) {
|
// Prefilter for parsing speed.
|
||||||
if (boost::algorithm::istarts_with(gcode_line, tag)) {
|
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<double>& values) {
|
||||||
|
if (boost::algorithm::starts_with(gcode_line, tag)) {
|
||||||
gcode_line = tag;
|
gcode_line = tag;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
for (size_t i = 0; i < values.size(); ++i) {
|
for (size_t i = 0; i < values.size(); ++i) {
|
||||||
|
@ -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;
|
const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
|
||||||
|
|
||||||
// let the label string start with "##" to hide the automatic label from ImGui::SliderFloat()
|
// 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);
|
std::string str_label = label_visible ? std::string("##") + std::string(label) : std::string(label);
|
||||||
|
|
||||||
// removes 2nd evenience of "##", if present
|
// removes 2nd evenience of "##", if present
|
||||||
|
Loading…
Reference in New Issue
Block a user