From 3107a4558d89655d39413a1fa3da127d4e8b2c1e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 15 Sep 2020 11:07:46 +0200 Subject: [PATCH] improved startup speed by optimizing parsing of parameter values Commit bd5cd062 (that introduced event actions for global animations) also added a nasty performance bottleneck due to complexity of parsing event action parameters, which slowed down program startup phase quite significantly. However, in most cases these parameters just stay at their default values, so checking for that default value first results in massively speeding up this part of the startup phase. --- src/files.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/files.c b/src/files.c index a78b46ac..49813391 100644 --- a/src/files.c +++ b/src/files.c @@ -10246,6 +10246,10 @@ static int get_anim_parameter_values(char *s) static int get_anim_action_parameter_value(char *token) { + // check most common default case first to massively speed things up + if (strEqual(token, ARG_UNDEFINED)) + return ANIM_EVENT_ACTION_NONE; + int result = getImageIDFromToken(token); if (result == -1) -- 2.34.1