mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 15:45:55 +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();
|
||||
|
||||
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<size_t>(0, m_objects.size(), 1), [this](const tbb::blocked_range<size_t> &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<size_t>(0, m_objects.size(), 1), [this](const tbb::blocked_range<size_t> &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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user