Path: fix unnecessary copy on read for Command.parameters dict
Contents of underlying c++ std::map data is copied to a new PyDict on every read. This is contrary to expected python behaviour which would normally just return the pointer to a python object and increment the reference counter for it. This was leading to massive redundant deletion and copying in all post processors which reference this variable in a nested loop. This PR adds a permanent dict member to the class and keeps track of changes to avoid unnecessary copying.
This commit is contained in:
@@ -43,7 +43,7 @@ pairs, or a placement, or a vector</UserDocu>
|
||||
</Methode>
|
||||
<Methode Name="setFromGCode">
|
||||
<Documentation>
|
||||
<UserDocu>toGCode(): returns a GCode representation of the command</UserDocu>
|
||||
<UserDocu>setFromGCode(): sets the path from the contents of the given GCode string</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="transform">
|
||||
@@ -51,5 +51,8 @@ pairs, or a placement, or a vector</UserDocu>
|
||||
<UserDocu>transform(Placement): returns a copy of this command transformed by the given placement</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<ClassDeclarations>
|
||||
mutable Py::Dict parameters_copy_dict;
|
||||
</ClassDeclarations>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
Reference in New Issue
Block a user