From 41f117277497329fa10ea1fc40a56b3ad3c7fe98 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 17 May 2026 14:30:45 +0200 Subject: [PATCH] Change order of IsFrameExternal checks. Check image first, then perform the expensive filename check. --- server/TracyWorker.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 9cfcd776..02527e86 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -8936,15 +8936,29 @@ void Worker::CacheSourceFiles() static bool IsFrameExternalImpl( const char* filename, const char* image ) { - if( strncmp( filename, "/usr/", 5 ) == 0 || strncmp( filename, "/lib/", 5 ) == 0 || strcmp( filename, "[unknown]" ) == 0 || strcmp( filename, "" ) == 0 ) return true; - if( strncmp( filename, "C:\\Program Files", 16 ) == 0 || strncmp( filename, "d:\\a01\\_work\\", 13 ) == 0 ) return true; + if( image && ( + strncmp( image, "/usr/", 5 ) == 0 || + strncmp( image, "/lib/", 5 ) == 0 || + strncmp( image, "/lib64/", 7 ) == 0 || + strcmp( image, "" ) == 0 + ) ) return true; + + if( + strncmp( filename, "/usr/", 5 ) == 0 || + strncmp( filename, "/lib/", 5 ) == 0 || + strcmp( filename, "[unknown]" ) == 0 || + strcmp( filename, "" ) == 0 || + strncmp( filename, "C:\\Program Files", 16 ) == 0 || + strncmp( filename, "d:\\a01\\_work\\", 13 ) == 0 + ) return true; + while( *filename ) { if( filename[0] == '/' && filename[1] == '.' && filename[2] != '.' ) return true; filename++; } - if( !image ) return false; - return strncmp( image, "/usr/", 5 ) == 0 || strncmp( image, "/lib/", 5 ) == 0 || strncmp( image, "/lib64/", 7 ) == 0 || strcmp( image, "" ) == 0; + + return false; } bool Worker::IsFrameExternal( StringIdx filename, StringIdx image ) const