mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-22 06:41:01 +00:00
perf: speed up G-code export by up to 8% via cheaper G-code text building (#16108)
This commit is contained in:
1 parent
32b1e69fdd
commit
5be5c90e59
13 files changed
+365
-84
No files matched your search
@@ -7,6 +7,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
@@ -111,7 +112,7 @@ public:
|
||||
void reset() { memset(m_position, 0, sizeof(m_position)); }
|
||||
void apply_config(const GCodeConfig &config);
|
||||
void apply_config(const DynamicPrintConfig &config);
|
||||
const GCodeConfig& config() { return m_config; };
|
||||
const GCodeConfig& config() { return m_config ? *m_config : default_config(); };
|
||||
|
||||
template<typename Callback>
|
||||
void parse_buffer(const std::string &buffer, Callback callback)
|
||||
@@ -172,7 +173,7 @@ public:
|
||||
|
||||
GCodeConfig get_config() const
|
||||
{
|
||||
return m_config;
|
||||
return m_config ? *m_config : default_config();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -199,8 +200,11 @@ private:
|
||||
return c;
|
||||
}
|
||||
static const char* axis_pos(const char *raw_str, char axis);
|
||||
static const GCodeConfig& default_config();
|
||||
|
||||
GCodeConfig m_config;
|
||||
// Set by apply_config() and shared by copies, so a reader without a config builds none.
|
||||
std::shared_ptr<const GCodeConfig> m_config;
|
||||
bool m_use_relative_e_distances{ default_config().use_relative_e_distances.value };
|
||||
float m_position[NUM_AXES];
|
||||
bool m_verbose;
|
||||
// To be set by the callback to stop parsing.
|
||||
|
||||
Reference in new issue
Block a user