summaryrefslogtreecommitdiff
path: root/type_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'type_decoder.c')
-rw-r--r--type_decoder.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/type_decoder.c b/type_decoder.c
index cff242c..59fb049 100644
--- a/type_decoder.c
+++ b/type_decoder.c
@@ -256,6 +256,12 @@ static inline struct srd_decoder_inst *srd_inst_find_by_obj(
struct srd_session *sess;
GSList *l;
+ /* Performance shortcut: Handle the most common case first. */
+ sess = sessions->data;
+ di = sess->di_list->data;
+ if (di->py_inst == obj)
+ return di;
+
di = NULL;
for (l = sessions; di == NULL && l != NULL; l = l->next) {
sess = l->data;