From: Holger Schemel Date: Tue, 15 Sep 2020 09:07:46 +0000 (+0200) Subject: improved startup speed by optimizing parsing of parameter values X-Git-Tag: 4.2.0.3~41 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3107a4558d89655d39413a1fa3da127d4e8b2c1e;p=rocksndiamonds.git 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. --- 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)