Linux high CPU usage

Hey everyone.

So we have an application that performs fine on macOS and Windows, registering barely any CPU usage normally, but uses 100% CPU at all times on Linux. So far this doesn’t seem to be something I can easily recreate with a simple example, so I’m asking if anyone has ideas of things to look for that might be specifically bad on Linux.

Any ideas appreciated.

Okay so I finally tracked it down to a thread that calls Sleep(500) and uses Locks to control iterations of its loop in the Run event handler. Is there a better / any other way to do this kind of thing?

dim batch as Collection
while not Done
  if Queue.Count > 0 then
    // Make a copy of the current queue as our batch to process,
    // then release the CriticalSection so we don't impact the UI
    batch = Queue
    Queue = new Collection
    dim data as Dictionary
    for i as integer = 1 to Batch.Count
      if Batch.Item(i) = nil then continue
      data = Batch.Item(i)
  end if

Seems like maybe just setting the sleep period to 2000 instead of 500 milliseconds helps a ton, though I wouldn’t expect it to be such a huge impact as it is fine on other platforms. Puzzling still.

Small hint: Collections are a very, very old language construct of Xojo, which has not been maintained for a long time. An array or, even better, dictionary should bring the code more up to date. Is there a compelling reason to use the slow collections?