Loading assets is slow when assets are iCloud based

in both Legacy (3.x) and Modern (4.X), on iPad Pro M1, code 3.16 (but problem already there since 3.14), “require()” loading assets takes more and more time when assets are located on iCloud (even if they are in cache on my device)

File1: test_main

require(asset.icloud.test_lib) – alternatively require(asset.documents.test_lib)

File2 : test_lib

whatever you want …

Open File1, execute (CMD R), stop, exec, stop, exec, stop … takes more and more time to load and execute when the files are located on iCloud. With significant libraries, first exec could be straightforward at first sight, then leads to minutes (!) to show the left hand side panel, then again minutes of wait to execute.

Am I the only one to encounter this ?

1 Like

Running on MacOs 26.4.1 (M1PRO 32Gb) leads to similar behavior (fast first exec, longer subsequent executions, then crashes).

Example of content for test_main:

require(asset.icloud.test_07_lib)
-- test_07

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
    if unit_test() then
        print("UT: ok")
    else
        print("UT: failed")
    end
end

function unit_test()
    cl = class_lib(4)
    print("cl.x    = ",cl.x)
    print("cl.coeff= ",cl.coeff)
    -- (2 * 4) + (1 * coef=3.14159) + 2 > 13.14159
    return cl:compute(2,1,2) == 13.14159
end

Example of content for test_07_lib:

-- test_07_lib (tab class_lib)
class_lib = class("class_lib")

function class_lib:init(x)
    -- you can accept and set parameters here
    self.x = x
    self.coeff = 3.14159
end

function class_lib:draw()
    -- Codea does not automatically call this method
end

function class_lib:touched(touch)
    -- Codea does not automatically call this method
end

function class_lib:compute(a, b, c)
    return (a * self.x) + (b * self.coeff) + c
end
1 Like

You’re not the only one to notice iCloud slowing things down in different ways, for sure. Codea iCloud stuff is nice to have when you need it but in general I prefer to keep projects local, and sync them between devices with WorkingCopy.

Thank you @UberGoober for your answer, I thought I was the only one encountering this type of issue.
I used to work with WorkingCopy in parallel to Pyto and/or Pythonista, I’ve not yet tried on Codea … Thks for this advice.
Best regards
F

1 Like

The trick with Codea is getting the repository to sync with the project as a “document” under the sync menu. But aside from a few minor glitches I love working copy.

Thank you for the repro steps. We’ll debug this issue