mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 19:15:56 +08:00
Optimization: Parallelize the for loops over individual PrintObjects
This commit is contained in:
parent
3277bba8c1
commit
37a088abac
@ -903,20 +903,29 @@ void Print::process()
|
|||||||
name_tbb_thread_pool_threads_set_locale();
|
name_tbb_thread_pool_threads_set_locale();
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Starting the slicing process." << log_memory_info();
|
BOOST_LOG_TRIVIAL(info) << "Starting the slicing process." << log_memory_info();
|
||||||
for (PrintObject *obj : m_objects)
|
|
||||||
obj->make_perimeters();
|
tbb::parallel_for(tbb::blocked_range<size_t>(0, m_objects.size(), 1), [this](const tbb::blocked_range<size_t> &range) {
|
||||||
for (PrintObject *obj : m_objects)
|
for (size_t idx = range.begin(); idx < range.end(); ++idx) {
|
||||||
obj->infill();
|
m_objects[idx]->make_perimeters();
|
||||||
for (PrintObject *obj : m_objects)
|
m_objects[idx]->infill();
|
||||||
obj->ironing();
|
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)
|
for (PrintObject *obj : m_objects)
|
||||||
obj->generate_support_spots();
|
obj->generate_support_spots();
|
||||||
// check data from previous step, format the error message(s) and send alert to ui
|
// 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();
|
alert_when_supports_needed();
|
||||||
for (PrintObject *obj : m_objects)
|
|
||||||
obj->generate_support_material();
|
tbb::parallel_for(tbb::blocked_range<size_t>(0, m_objects.size(), 1), [this](const tbb::blocked_range<size_t> &range) {
|
||||||
for (PrintObject *obj : m_objects)
|
for (size_t idx = range.begin(); idx < range.end(); ++idx) {
|
||||||
obj->estimate_curled_extrusions();
|
m_objects[idx]->generate_support_material();
|
||||||
|
m_objects[idx]->estimate_curled_extrusions();
|
||||||
|
}
|
||||||
|
}, tbb::simple_partitioner());
|
||||||
|
|
||||||
if (this->set_started(psWipeTower)) {
|
if (this->set_started(psWipeTower)) {
|
||||||
m_wipe_tower_data.clear();
|
m_wipe_tower_data.clear();
|
||||||
m_tool_ordering.clear();
|
m_tool_ordering.clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user