Anim: thread remake_graph_transdata #119497
|
@ -886,32 +886,32 @@ static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totve
|
|||
*/
|
||||
static void remake_graph_transdata(TransInfo *t, const blender::Span<FCurve *> fcurves)
|
||||
{
|
||||
SCOPED_TIMER_AVERAGED("remake");
|
||||
SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
|
||||
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
|
||||
|
||||
|
||||
blender::threading::parallel_for(
|
||||
fcurves.index_range(), 16, [&](const blender::IndexRange range) {
|
||||
for (const int i : range) {
|
||||
FCurve *fcu = fcurves[i];
|
||||
blender::threading::parallel_for(fcurves.index_range(), 1, [&](const blender::IndexRange range) {
|
||||
dr.sybren marked this conversation as resolved
Outdated
Falk David
commented
Looks like you don't need the index here, so it might be better to use Looks like you don't need the index here, so it might be better to use `parallel_for_each`. Of course, that's only if you actually want a grain size of one.
Iliya Katushenock
commented
Even with grain size Even with grain size `1`, `range` can have any size. But i wonder if this will be better to test `parallel_for_weighted` here.
Hans Goudey
commented
`parallel_for_each` uses a different algorithm internally that has more overhead. AFAIK it will always give each element its own thread. I think it's typically only suitable for much more expensive tasks.
|
||||
for (const int i : range) {
|
||||
FCurve *fcu = fcurves[i];
|
||||
|
||||
Sybren A. Stüvel
commented
Gitea already doesn't present this as "it's all the same, just indented", so I think it's fine to restructure the code a bit further for readability. `if (!fcu->bezt) { continue; }`
Gitea already doesn't present this as "it's all the same, just indented", so I think it's fine to restructure the code a bit further for readability.
|
||||
if (fcu->bezt) {
|
||||
BeztMap *bezm;
|
||||
if (fcu->bezt) {
|
||||
BeztMap *bezm;
|
||||
|
||||
/* Adjust transform-data pointers. */
|
||||
/* NOTE: none of these functions use 'use_handle', it could be removed. */
|
||||
bezm = bezt_to_beztmaps(fcu->bezt, fcu->totvert);
|
||||
sort_time_beztmaps(bezm, fcu->totvert);
|
||||
beztmap_to_data(t, fcu, bezm, fcu->totvert);
|
||||
/* Adjust transform-data pointers. */
|
||||
/* NOTE: none of these functions use 'use_handle', it could be removed. */
|
||||
bezm = bezt_to_beztmaps(fcu->bezt, fcu->totvert);
|
||||
sort_time_beztmaps(bezm, fcu->totvert);
|
||||
beztmap_to_data(t, fcu, bezm, fcu->totvert);
|
||||
|
||||
/* Free mapping stuff. */
|
||||
MEM_freeN(bezm);
|
||||
/* Free mapping stuff. */
|
||||
MEM_freeN(bezm);
|
||||
|
||||
/* Re-sort actual beztriples
|
||||
* (perhaps this could be done using the beztmaps to save time?). */
|
||||
sort_time_fcurve(fcu);
|
||||
}
|
||||
}
|
||||
});
|
||||
/* Re-sort actual beztriples
|
||||
* (perhaps this could be done using the beztmaps to save time?). */
|
||||
sort_time_fcurve(fcu);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Run the handle recalculation outside the parallel_for
|
||||
* because it might use threading itself. */
|
||||
|
|
Loading…
Reference in New Issue
Add a comment that explains how the 8 got here.