diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 9ed95dddf3..8f6c65f2f8 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -903,20 +903,29 @@ void Print::process() name_tbb_thread_pool_threads_set_locale(); BOOST_LOG_TRIVIAL(info) << "Starting the slicing process." << log_memory_info(); - for (PrintObject *obj : m_objects) - obj->make_perimeters(); - for (PrintObject *obj : m_objects) - obj->infill(); - for (PrintObject *obj : m_objects) - obj->ironing(); + + tbb::parallel_for(tbb::blocked_range(0, m_objects.size(), 1), [this](const tbb::blocked_range &range) { + for (size_t idx = range.begin(); idx < range.end(); ++idx) { + m_objects[idx]->make_perimeters(); + m_objects[idx]->infill(); + m_objects[idx]->ironing(); + } + }, tbb::simple_partitioner()); + + // The following step writes to m_shared_regions, it should not run in parallel. for (PrintObject *obj : m_objects) obj->generate_support_spots(); // check data from previous step, format the error message(s) and send alert to ui + // this also has to be done sequentially. alert_when_supports_needed(); - for (PrintObject *obj : m_objects) - obj->generate_support_material(); - for (PrintObject *obj : m_objects) - obj->estimate_curled_extrusions(); + + tbb::parallel_for(tbb::blocked_range(0, m_objects.size(), 1), [this](const tbb::blocked_range &range) { + for (size_t idx = range.begin(); idx < range.end(); ++idx) { + m_objects[idx]->generate_support_material(); + m_objects[idx]->estimate_curled_extrusions(); + } + }, tbb::simple_partitioner()); + if (this->set_started(psWipeTower)) { m_wipe_tower_data.clear(); m_tool_ordering.clear();