Testing notes:
- The project has Build Optimization Level set to Moderate. @Kem_Tekinay reported, and I confirm that on Aggressive it never seems to compile [Edit: it takes an hour+ to compile, and runs more slowly] Kem reported this: https://tracker.xojo.com/xojoinc/xojo/-/issues/77604
- A quick way to optimize is to run the built app, open ActivityMonitor.app, and take a sample of the process. You’ll get a stack trace sample with the methods taking the longest at the top, as in this example:
Sample
Call graph:
2330 Thread_10814897 DispatchQueue_1: com.apple.main-thread (serial)
+ 2330 start (in dyld) + 1909 [0x7ff80e6c2345]
+ 2330 main (in Xojo1BRC) + 19 [0x10219b803]
+ 2330 _Main (in Xojo1BRC) + 458 [0x10219be1a]
+ 2330 REALbasic._RuntimeRun (in Xojo1BRC) + 19 [0x1020ce273]
+ 2330 RuntimeRun (in rbframework.dylib) + 53 [0x1035382df]
+ 2330 CallFunctionWithExceptionHandling(void (*)()) (in rbframework.dylib) + 134 [0x1035a01b1]
+ 2330 ConsoleApplication._CallFunctionWithExceptionHandling%%o<ConsoleApplication>p (in Xojo1BRC) + 184 [0x1020a1888]
+ 2330 CallConsoleApplicationRunEventHelper() (in rbframework.dylib) + 325 [0x1034c3db8]
+ 2330 App.Event_Run%i8%o<App>A1s (in Xojo1BRC) + 9630 [0x10213dece]
+ 2330 Baseline.Process%%o<FolderItem>o<FolderItem> (in Xojo1BRC) + 226 [0x102186ad2]
+ 675 Baseline.ProcessIntoDictionary%o<Dictionary>%o<FolderItem> (in Xojo1BRC) + 1924 [0x102182314]
+ ! 670 String.$ToDouble%f8%s (in Xojo1BRC) + 22 [0x101ddeff6]
+ ! : 662 String.$CDbl%f8%s (in Xojo1BRC) + 22 [0x101ddd796]
+ ! : | 305 runCDbl (in rbframework.dylib) + 284 [0x10359c06c]
+ ! : | + 305 replaceAll(string, string, string) (in rbframework.dylib) + 78 [0x10359a480]
+ ! : | + 75 StringOpsClassic::ReplaceAllText(StringStorageBase*, StringStorageBase*, StringStorageBase*) (in rbframework.dylib) + 932 [0x10360ddde]
+ ! : | + ! 34 ??? (in rbframework.dylib) load address 0x1032f6000 + 0x3138d5 [0x1036098d5]
From this you can see the hottest method is in the String.ToDouble() method, which appears to have a lot of string processing inside it (including a call to ReplaceAllText which perhaps should be reported as a separate bug?)