If you participate in t’other forum, you may have seen an interesting thread, where I made a discovery with Xojo shell class. Several members advised me to file a feedback with Xojo, but I’ve become pessimistic and bitter about filing any kind of feedback with Xojo.
Today, I decided that I should at least give it “one more try”…
I’ve discovered the Xojo shell class is energy inefficient when running asynchronous tasks (and potentially workers). It’s been pointed out, that’s because the Xojo shell class replicates a shell and isn’t the best tool for running commandline apps.
When using NSTask (via declares) to run an asynchronous task, the calling application’s energy usage dropped by 90% ~ 98%. Another advantage of using NSTask is that I was able to request the macOS to run the executable on the efficiency cores of a ARMac, thus reducing energy usage even further.
There are two Xojo feedbacks for this functionality .
#26605 - NSTask functionality is required for running console applications in a Sandboxed application
#66317 - Add QualityOfService parameters to Xojo Workers and shells
If anyone is interested in using NSTask in their Xojo made applications, I have made available, the source code that I used for this test (and from within my application).
https://ohanaware.com/appkit/NSTaskEfficiencyTest.zip
I do hope that Xojo will either improve their Shell class or implement a NSTask class, so they can help Xojo customers reduce any wasted electricity.