From 4fbe77fb82f7a5b761fdbfc2e0bf4c9e2c95e15b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 1 May 2016 16:49:35 -0500 Subject: [PATCH] Very minor optimization for ACS str(i)cmp - If the two strings compared both point to the same location in memory, then we know they are the same string without having to bother actually comparing their contents. Note that the opposite is not neccessarily true: If they point to two different locations, they could still match a case-sensitive comparison because there are still two ACS string tables: the one that belongs to the map's script and the one that belongs to everything else. --- src/p_acs.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 003138211..032abbc27 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5567,6 +5567,11 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) if (argCount >= 2) { const char *a, *b; + // If the string indicies are the same, then they are the same string. + if (args[0] == args[1]) + { + return 0; + } a = FBehavior::StaticLookupString(args[0]); b = FBehavior::StaticLookupString(args[1]);