Large project makes IDE unresponsive and take ages to check / load/ respond

Hello guys,

Any ideas, advices for large projects ? i have one quite large and it seems that it takes ages to load and to check all, If i press Command + K i make a coffee and i wait 10, 15 min to get the app checked and it seems that with the latest version of Xojo it gets more and more slow.

On the Interface side of the ide still a lot of delays on the objects placements, specially if i have a rich interface then i place a button on the interface then it`s like replay , put it and wait until it decides to stop moving, then move it again and so on, nothing like this happens with small project.

One more thing and i guess its related more to Christians plugins and to plugins in general , is there a way to remove the plugins i dont use ? i noticed the IDE is more responsive and works a lot faster when it has only the base plugins, so it will be nice to know what plugins i use and to remove the rest i don`t use , at least it will help little bit.

Now honestly i have 2 folders of XOJO on the Applications folder one with MBS plugins and use it for the current project and one without and use it for the rest of the projects, and the difference in handling / speed/ responsiveness is huge .

Thanks .

I do have a project which takes 10 minutes to load!
The size is a problem for code which does not use dictionaries to lookup things.

Try to work on your project after a boot on an external hard disk (HD).
Move your project to an external HD and check.
Boot on the Recover partition and run Disk Utils.

How large is the free part on your boot disk ?
(Below 20MB it starts to slow down, 50: it rocks with my SSD).

Did you free the Xojo Cache folder (in Library:Caches) ?

etc.

[quote=349860:@Christian Schmitz]I do have a project which takes 10 minutes to load!
The size is a problem for code which does not use dictionaries to lookup things.[/quote]
So what you recommend in this case ?

[quote=349869:@Emile Schwarz]Try to work on your project after a boot on an external hard disk (HD).
Move your project to an external HD and check.
Boot on the Recover partition and run Disk Utils.

How large is the free part on your boot disk ?
(Below 20MB it starts to slow down, 50: it rocks with my SSD).

Did you free the Xojo Cache folder (in Library:Caches) ?

etc.[/quote]
Hello Emile,

Well i had a look there and i have some DBs and some files so i dont want to mess xojo by deleting those, if there are some safe way to doit then ok otherwise i don`t want to risk

Well i do have a mac book pro retina display with i7, 16 gb ram and 756 gb ssd , as for the free space , i have around 156 GB so i don`t think that is a problem.

How large is your project? Even on my not so fast MacBook Air my project with 450 classes opens in a minute.

Regarding the plugins: have a look through them and eliminate the obvious ones first. Do you use Tidy or not? If not, delete the plugin. Afterwards remove 5 or so plugins. Quit/restart Xojo. Check if everything works or if you need to restore a plugin. Rinse/repeat.

Does the format of a project make a difference?

Wrong folder.

On macOS, the Xojo Cache folder resides in the User’s Library:
Library:Caches:Xojo:

Its contents can be a series of folder with names like:
2015.01.00.fc.28976

for a project opened witj Xojo 2015r1.

The Xojo folder you found holds data for each of the Xojo versions you ran, with the local LR db, and eventually, a Feedback folder. You can delete them, but beside the specific data (?), Xojo will create these back at the next Xojo / Feedback run.

Hardware properties:
OK.

Did you run the Disk Utils application ? Sometimes, the OS dislike crash, sudden (or not) power off, etc. If your SSD have one of these, the entry will be in red.
There are a bunch of years since I saw one, but I fire Disk Utils on a regular base (just in case).

Did you try to export your project to XML (and import it from that XML) ?

Nothing. I just open the project, go to get a drink and wait.

You can reduce plugins, but I always use all of my plugins and I don’t think plugins is the problem.

Could you imagine if your car works like that :slight_smile:

And I have a pdf taking miniutes to load… 20000 pages … :slight_smile:

You can remove the Xojo folder from Caches when the Xojo IDE is not running without problem. Keep in mind that doing so will cause the IDE to rebuild the plugins the next time you build.

That said, because of the size of them, we don’t typically use resources embedded in our projects any more unless there’s no other way to do it. They typically have 100+ images and icons and we load them dynamically at runtime. It means that we can’t “see” the entire layouts when we work on the projects if there are custom graphics, but it also means that there are 100+ less objects for the IDE to load and keep track of.

[quote=350059:@Greg O’Lone]You can remove the Xojo folder from Caches when the Xojo IDE is not running without problem. Keep in mind that doing so will cause the IDE to rebuild the plugins the next time you build.

That said, because of the size of them, we don’t typically use resources embedded in our projects any more unless there’s no other way to do it. They typically have 100+ images and icons and we load them dynamically at runtime. It means that we can’t “see” the entire layouts when we work on the projects if there are custom graphics, but it also means that there are 100+ less objects for the IDE to load and keep track of.[/quote]
Thanks Greg,

Any advice on storing the tons of images and logos and external resources that i have ?

Now they are all in the project as images but i see that it would be better to load them on build or somehow and have them referenced but that means writing a lot of code for it or having a better ways of referencing them.

I was thinking as well to use like a .pdf to hold most of them linked to the interface and get them from there more like web stile but still figuring on how to do that.

Due to the GIT storing in order to avoid app searching and creating errors as it does not find resources i had to make a .DMG image with all the resources and have them loaded before i start the project but recently with having to work on windows as well i will need to find another way to store those across the operating systems. I remember reading something about a new extension format that would hold better the project files and be more ready for versioning apps . Any update on that ?

Thanks again.

Storing in a database ? For example an sqlite-file in the resource folder of your app.

That could actually be a good idea, thanks

I wouldn’t. Databases are generally not good for storing large numbers of binary data in my opinion.

My suggestion is to make a folder next to your project where the images live and then load them at runtime by name. You can easily use a dictionary to cache them in memory to avoid duplicate lookups.

I’ll type out some pseudo code when I get to my desk.

We usually do this with a module… lets call it Icons.

You’ll need a property to hold the cache:

Private Cache as Dictionary

and a method for retrieving pictures:

[code]Protected Function Get(ImageName as String) as Picture
// Initialize the cache if necessary
if Cache = Nil then Cache = New Dictionary

// If we’ve already built the image, just return that
if Cache.HasKey(ImageName) then
Return Cache.Value(ImageName)
end if

Dim MaxRez as Integer = 1
if app.SupportsHiDPI then
MaxRez = 3 // Or whatever the max rez is that you want
end if

Dim ResFolder as Folderitem = GetResourcesFolder() // You’ll have to define this
Dim pics() as Picture
For i as Integer = 1 to MaxRez
// Typically 1x images don’t have a @1x suffix
dim suffix as string = if(i=1,"","@" + str(i,“0”) + “x”)

// Get the folderitem and exit if it doesn't exist
dim filename as string = ImageName + suffix + ".png"
dim f as folder = ResFolder.child(filename)
if f.Exists = False then Exit For i

#if DebugBuild
  // Some code to warn us if the case of the file found is not the same
  // as the case we specified
  if strcomp(filename,f.name,1) <> 0 then
    msgbox filename + " and " + f.name + " don't match!!!!"
  end If
#EndIf

// Load the picture and exit if it returns nil
dim p as picture = Picture.Open(f)
if p = nil then Exit For i

// Add it to the array
pics.append p

Next i

// If we didn’t get any pictures, just return nil
if ubound(pics) = -1 then
return Nil
end If

dim NewPic as Picture
if ubound(pics) = 0 or app.SupportsHiDPI = false then
// Only use the first image
NewPic = pics(0)
else
// Assemble an in memory image
NewPic = New Picture(pics(0).width, pics(0).height, pics)
end if

// Add the new image to the cache
Cache.value(ImageName) = NewPic

// Return the new image
Return NewPic
End Function[/code]

In your code, you call it like this:

dim p as picture = Icons.Get("MyIcon")

[quote=350432:@Greg O’Lone]Protected Function Get(ImageName as String) as Picture
// Initialize the cache if necessary
if Cache = Nil then Cache = New Dictionary

// If we’ve already built the image, just return that
if Cache.HasKey(ImageName) then
Return Cache.Value(ImageName)
end if

Dim MaxRez as Integer = 1
if app.SupportsHiDPI then
MaxRez = 3 // Or whatever the max rez is that you want
end if

Dim ResFolder as Folderitem = GetResourcesFolder() // You’ll have to define this
Dim pics() as Picture
For i as Integer = 1 to MaxRez
// Typically 1x images don’t have a @1x suffix
dim suffix as string = if(i=1,"","@" + str(i,“0”) + “x”)

// Get the folderitem and exit if it doesn't exist
dim filename as string = ImageName + suffix + ".png"
dim f as folder = ResFolder.child(filename)
if f.Exists = False then Exit For i

#if DebugBuild
  // Some code to warn us if the case of the file found is not the same
  // as the case we specified
  if strcomp(filename,f.name,1) <> 0 then
    msgbox filename + " and " + f.name + " don't match!!!!"
  end If
#EndIf

// Load the picture and exit if it returns nil
dim p as picture = Picture.Open(f)
if p = nil then Exit For i

// Add it to the array
pics.append p

Next i

// If we didn’t get any pictures, just return nil
if ubound(pics) = -1 then
return Nil
end If

dim NewPic as Picture
if ubound(pics) = 0 or app.SupportsHiDPI = false then
// Only use the first image
NewPic = pics(0)
else
// Assemble an in memory image
NewPic = New Picture(pics(0).width, pics(0).height, pics)
end if

// Add the new image to the cache
Cache.value(ImageName) = NewPic

// Return the new image
Return NewPic
End Function[/quote]
Well Thanks Greg,

The issue was always the resource folder and the file linkage so whenever one developer fetches that from git he will have to pass trough all and check them again which is annoying when you have 1000 of icons .

Is there a way to Select always the Parent Folder, i mean the Folder where the project sits ? and put like a step or something in the IDE when loading will do this ? and it seems that for each icon that i have in the interface i will have to add that code for it to fetch and update.

It will be some work to do but i hope it will help with getting rid of the .dmg folder which did a great job so far .

Thanks again.

You use a CopyFileStep and copy to App Parent Folder if it’s a folder or Resources if it’s a series of files. You can figure out the name of the resources directory because it can only be one of two things. Either “AppName Resources” or “Resources”. Or just put them in another folder with a name of your choosing.

Yes. Instead of just referring to them by name, you’ll have to load them first. So if the name of the image is “UserIcon” your code would be:

dim UserIcon as Picture = Icons.Get(“UserIcon”)

Or in your “Icons” module you mimic what the IDE does for you when you drag an image into a project and write

  Function UserIcon as Picture
          static mUserIcon as Picture
          if mUserIcon is nil then
               mUserIcon = Icons.Get(“UserIcon”)
           end if
           return mUserIcon
   end function

and you probably need better error checking

This way you dont even have to change much code

The places you WILL have to are those where you’ve used the IDE layout editor & selected an image for a window backdrop, canvas backdrop etc from the pop up menu to select an icon