This issue comes from https://github.com/Samsung/ONE/issues/2610#issuecomment-649280855
OpSequences::findOperation traverses whole operations to find target operation.
It seems that function can be optimized in many ways.
I'll implement options and compare the performance.
for (const auto &op_idx : object.operations())
{
if (op_idx == operation_index)
+ {
ret = index;
+ return;
+ }
}
});
return ret;
iterate functioniterate function always traverse whole OpSequencesOpSequence searches can be skipped by accessing the operations directly OpSequenceIndex ret;
for (auto &e : _objects)
{
OpSequence &object = *e.second;
auto it = find(object.operations().begin(), object.operations().end(), operation_index);
if (it != object.operations().end())
{
ret = e.first;
return ret;
}
}
return ret;
OpSequences classOpSequence::appendOperation are untrackablefindOperation is executedfindOperation is const member functionOpSequence classfindOperation should traverse OpSequencesOpSequences classmutable for mutable std::unordered_map<OperationIndex, OpSequenceIndex> _seq_indexes;
All related PRs merged.
Most helpful comment
Testing early stop
Master
https://github.com/Samsung/ONE/blob/52bc738295f267dd75c265e9cee3e5ff1e855a06/runtime/onert/core/src/ir/OpSequences.cc#L73-L84
Trial 1 : Add return function