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
3395b288c4
commit
a93620621d
2 changed files with 8 additions and 3 deletions
src/libslic3r/GCode
|
@ -3779,8 +3779,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<double>& 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<double>& values) {
|
||||
if (boost::algorithm::starts_with(gcode_line, tag)) {
|
||||
gcode_line = tag;
|
||||
char buf[1024];
|
||||
for (size_t i = 0; i < values.size(); ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue