Avoid merging meshes when there is only one mesh to merge.

When slicing yoda.stl it reduces peak memory usage by 5% and speeds up
slicing by 13%.
Further optimization using a simple proxy to implement the two methods
(size/extends) needed on the merge meshes is also possible and
undoubtedly worthwhile.
xs
Mark Hindess 2013-04-18 19:50:05 +01:00
parent 407de02fe4
commit aac2c45450
1 changed files with 2 additions and 1 deletions

View File

@ -118,7 +118,8 @@ sub add_model {
$mesh->scale($Slic3r::Config->scale / &Slic3r::SCALING_FACTOR);
}
my $complete_mesh = Slic3r::TriangleMesh->merge(grep defined $_, @meshes);
my @defined_meshes = grep defined $_, @meshes;
my $complete_mesh = @defined_meshes == 1 ? $defined_meshes[0] : Slic3r::TriangleMesh->merge(@defined_meshes);
# initialize print object
my $print_object = Slic3r::Print::Object->new(