Anim: thread remake_graph_transdata #119497
|
@ -889,9 +889,17 @@ static void remake_graph_transdata(TransInfo *t, const blender::Span<FCurve *> f
|
|||
SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
|
||||
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
|
||||
|
||||
/* Sort and reassign verts. */
|
||||
for (FCurve *fcu : fcurves) {
|
||||
if (fcu->bezt) {
|
||||
/* The grain size of 8 was chosen based on measured runtimes of this function. While 1 is the
|
||||
|
||||
* fastest, larger grain sizes are generally preferred and the difference between 1 and 8 was
|
||||
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.
|
||||
* only minimal (~330ms to ~336ms). */
|
||||
blender::threading::parallel_for(fcurves.index_range(), 8, [&](const blender::IndexRange range) {
|
||||
for (const int i : range) {
|
||||
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.
|
||||
FCurve *fcu = fcurves[i];
|
||||
|
||||
if (!fcu->bezt) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BeztMap *bezm;
|
||||
|
||||
/* Adjust transform-data pointers. */
|
||||
|
@ -907,10 +915,9 @@ static void remake_graph_transdata(TransInfo *t, const blender::Span<FCurve *> f
|
|||
* (perhaps this could be done using the beztmaps to save time?). */
|
||||
sort_time_fcurve(fcu);
|
||||
|
||||
/* Make sure handles are all set correctly. */
|
||||
testhandles_fcurve(fcu, BEZT_FLAG_TEMP_TAG, use_handle);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void recalcData_graphedit(TransInfo *t)
|
||||
|
|
Loading…
Reference in New Issue
Add a comment that explains how the 8 got here.