Speed improvement of initial G-code preview:
1) Preallocating the vertex / index buffers to limit reallocation. 2) Inlining the pushing into the vertex / index buffers. 3) Running the vertex buffer generator on a limited number of threads as the generator does not scale well due to memory pressure. Not using all the threads leaves some of the threads to G-code generator.
This commit is contained in:
parent
14e0cd0e96
commit
9aee934d53
4 changed files with 28 additions and 25 deletions
|
@ -6873,6 +6873,11 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||
return volume;
|
||||
};
|
||||
const size_t volumes_cnt_initial = m_volumes.volumes.size();
|
||||
// Limit the number of threads as the code below does not scale well due to memory pressure.
|
||||
// (most of the time is spent in malloc / free / memmove)
|
||||
// Not using all the threads leaves some of the threads to G-code generator.
|
||||
tbb::task_arena limited_arena(std::min(tbb::this_task_arena::max_concurrency(), 4));
|
||||
limited_arena.execute([&ctxt, grain_size, &new_volume, is_selected_separate_extruder, this]{
|
||||
tbb::parallel_for(
|
||||
tbb::blocked_range<size_t>(0, ctxt.layers.size(), grain_size),
|
||||
[&ctxt, &new_volume, is_selected_separate_extruder, this](const tbb::blocked_range<size_t>& range) {
|
||||
|
@ -7047,6 +7052,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||
vol->indexed_vertex_array.shrink_to_fit();
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
});
|
||||
}); // task arena
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - finalizing results" << m_volumes.log_memory_info() << log_memory_info();
|
||||
// Remove empty volumes from the newly added volumes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue