-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Editor: Any filesystem operation (moving, creating files) trigger a full reimport after #84974 due to bad tracking of .import modified time #94416
Comments
I wonder if this is due to Android scoped storage bottlenecking I/O performance somehow. Unfortunately, there's no way to opt out of this in Android 11 or later. |
Idk, what i think could happen is that the android editor might be reloading the scene every time you want to acces it storage or when you go from one window unrelated to the editor , and then back to the editor , as it loading it similar to when you want to load your project. It a really weird case noticeable on big project with all scripts. Shaders etc, because , for example in the sun temple modified project, it not taking as long as the tps or my project. You can reproduce it in your sansung tab 9 ultra? Edit the remove file slowdown is clear to be android fault even on an igpu removing files is instant( at the cost of making my pc black screen. Again..) |
I can reproduce this on the Truck Town demo on 4.3.beta 92c8e87 (Android 14, Samsung Galaxy Tab S9 Ultra). Renaming or moving a single file takes 3+ seconds despite that demo only have a few dozen files. Doing this on my desktop PC takes about 300 milliseconds in comparison. While my PC is a good deal faster than this tablet, I'd expect the operation to take less than 1 second on the tablet. Deleting a file (such as a newly duplicated image that isn't used in any scene) doesn't seem to take any significant amount of time though. I don't have access to devices that run Android versions older than 11 to check if this is related to scoped storage. |
Weird, have you tried on the tps demo? I think for removing files, that were the most noticeable speed slowness happens as it way bigger than the truck demo( way more files) , trying on the igpu in the past was instant (1 sec). Same goes when you go from another window, and get back at the godot one, going from play to editor mode or duplicating a file.
Weird tho , i can't reproduce the slowness of renaming files( it slow, but it just 2-3 seconds renaming a folder on the tps demo) |
I don't have access to an Android to test it, but from what I see, my guess is that |
To confirm that hypothesis, could someone affected test earlier beta snapshots to see if this is indeed a regression in beta 3? |
Testing on the tps demo modifed project( lurked from the forge final collaboration pr tests,. Take into account seconds may vary a bit as it not accurate enough, because i am just using the watch cronometer without a tool script) On 4.3 beta 3 it takes 1 minute 20 seconds On 4.3 beta 1 it takes 16 seconds and removing files is instant this time without the whole project reloading itself Then to test if regression was between beta 2 it takes just like beta 1 17 seconds. So it seems's this is a regression, in my opinion it more on the side of reimporting assets than scanning, as reimport is clearly what takes the most time here. |
I was suggesting scanning because reimport assets should not occur at all when opening a project, renaming files or returning to the editor after going to another window, if no changes are made on the disk. But seriously, without debugging, I can be in the absolute wrong!! |
It understandable, debugging on android is way harder than pc ( where even trying to put the error logs actions is hard, because the format is aabb instead of apk ) Sadly it seems reimporting is still happening on 4.3 beta 3 based mainly on the m4gr3d exporting pr that fixes the loading import screen in android which allows to show that the main slowdown despite no changes are made in project files. Edit in case it wasn't android exclusive i tried the hilderin filesystem dock pr, and it works well there( no reimporting file, just reopening the scene after scanning the project files. ) |
This is getting real weird here, like after i installed 4.3 beta 2 and 1 and then after doing the test there and turning on beta 3 project, now it has the same loading speed and the slowdown on removing files is gone. I have a theory that this might have happened : because these project were first opened in 4.3 beta 3( which looks to be the faulty one as beta 1 and 2 never seemed to run on this), they were fixed when they were transfered to the older versions which might explain why when transfering it back to beta 3 it fixed. So here's the what we can do Install a zip largue project ( for example the tps demo one) and extract it. Also keep the zip folder Procced to install godot 4.3 beta 3 and launch the project, ( notice how slow is it as it reimporting the entire project) Now uninstall godot 4.3 beta 3( to allow the older version to be installed) and delete the extracted project( as if we used this one in the older beta it will be fixed when going back to beta 3) Then install beta 2 or 1, launch it, quit, and then extract the project to import it into these versions( notice how when it loads it goes much faster and theres no slowdown when removing filws). Sorry if this is confusing i try what i can and |
Wow, this is a very intriguing turn of event!! I finally was able to test on my Samsung A14 on Android 14. I tested the TPS demo project and unfortunately, I was not able to reproduce the long project loading and rescanning when removing a file or opening a scene. I used a custom build from master. |
Interesting , what custom build did you use ? You got any artifact from it? Edit: Using an artifact from the last merge( this one https://github.com/godotengine/godot/actions/runs/10022669772 ) and still able to reproduce this problem on the project i mentioned. Video for proof( file size too big). https://drive.google.com/file/d/1FpnbU_I_A8lFnTvLI568sd1iONncOAKR/view |
I just tested on my device using this artefact: https://github.com/godotengine/godot/actions/runs/10022669772 Maybe I do something wrong to reproduce the problem. This is what I did:
But... then I tried to start the game... it worked, but, when I closed it and got back to Godot, it took a couple of minutes with a file system rescan and a black screen, exactly as the first load. I'll try to add more print log later and do more testing now that I'm able to reproduce the problem. |
After much testing, I'm really not able to reproduce the original problemof this issue on my device, even if I use the artefact https://github.com/godotengine/godot/actions/runs/10022669772. I thought I was able to reproduce the problem, but it was only the fact that when the running game is closed, Godot is completely restarted and opening the scene from TPS demo takes around 15 seconds on my device. I don't known if it's normal that Godot must be restarted at each start/stop of the game? I never had the problem where files are being reimported even if not modified. The other thing I find strange is the fact that scanning the project takes around 3 seconds which is not that fast considering that the project contains only 588 files. Sorry, maybe someone else will have more luck or maybe it's a problem on some device only. |
Weird that the only part where you can reproduce this too( i have the same problem when you leave the edutor window or run and then quit the game,which doesn't happen in beta 2 and 1 and it took me minutes for the project to load after that)
Well the device is not that slow, though for me and my s23+ it takes more , and that kind of similar to my time rescanning in pc.
It's ok, it can be more or less workarounded by doing what i said , but it pretty annoying and more if new people run into this stuff..though i didn'rt really mean about renaming files, just when you remove them from file system which is when editor redraws itself Also about the android studio thing , what do you meanv by that? Did you install something or moved from file manager? |
So I did some testing and I can reproduce the issue in 4.3.beta3 and latest The symptoms I see are that any filesystem operation triggers a rescan (that's expected, or at least not a new issue - #50576), but since 4.3.beta3 that rescan takes much longer (like a minute), or seems to be stuck at around 100% for a long time.
I confirmed that hypothesis. @Hilderin was referring to #84974, and indeed reverting that PR fixes the issue. After the revert, there is still a rescan on any operation, but it takes 2-3s. Now, that's a bit surprising as #84974 should be triggering reimports, not just rescans. I wonder if on the Android editor imports are "hidden" and bundled in the FS dock rescan, at least visually? |
BTW the TPS demo is really overkill for testing this bug, it's reproducible also with smaller projects. I suggest Kenney's 3D platformer starter kit from the AssetLib (with #94662 to make the progress dialog visible). |
I would say it more that the project itself is not taking into account the .godot folder and it might just think that we are importing a new project, as the only thing that seems faster after project reloading are the files scans. Edit: Interestingly enough ,though this is for a different issue, after testing #94662 i noticed that in the project manager when you want to import a project you can't browse anything and this what you see on screen, where i can only see the tps folder that i examined to open the project. Though this is not rekated to this pr as it noticeable in older artifact like the one you last merged 2/3 days ago |
Added some prints and confirmed that the cached import modified time is wrong: diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 0b2cf1424b..44b4a8dad8 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -722,8 +722,11 @@ bool EditorFileSystem::_update_scan_actions() {
String full_path = ia.dir->get_file_path(idx);
bool need_reimport = _test_for_reimport(full_path, false);
+ print_line(vformat("*** TEST REIMPORT ***: _test_for_reimport: %s", need_reimport ? "true" : "false"));
if (!need_reimport && FileAccess::exists(full_path + ".import")) {
uint64_t import_mt = ia.dir->get_file_import_modified_time(idx);
+ print_line(vformat("*** TEST REIMPORT ***: get_file_import_modified_time: %d", import_mt));
+ print_line(vformat("*** TEST REIMPORT ***: FileAccess::get_modified_time: %d", FileAccess::get_modified_time(full_path + ".import")));
if (import_mt != FileAccess::get_modified_time(full_path + ".import")) {
need_reimport = true;
}
|
I made a proper MRP with a single glb file, so it's easier to test and compare the effect of different builds:
I did that with the above MRP, but didn't find anything conclusive in the differences of the I can still reproduce the fact that:
So "fixing" the bug by opening it with a reverted build doesn't seem to be tied to the contents of files in
I don't have time to keep poking at this myself, so I'd appreciate help from folks familiar with EditorFileSystem (@KoBeWi, @Hilderin) and/or debugging Android-specific issues (@m4gr3d). In particular I don't know if it's possible to step through the editor code from Android Studio, but that could help understand why the import times are 0 at this step. For 4.3.rc1, I will just |
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
I've done that with #94691, so this is no longer a release blocker IMO. To anyone who wants to further debug this issue and attempt to fix it, you'd have to revert #94691 to see the bug again. |
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
Thanks a lot @akien-mga for your tests and debug. I'm still not able to reproduce the problem on my side so I created a draft PR #94717 if someone wants to use the artefact from the PR and test on their device and paste me the output logs, I would be able to better comprehend the problem and maybe find a solution. Artefact: https://github.com/godotengine/godot/actions/runs/10087688942/artifacts/1737806253 |
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
I debugged the logic flow and found out that For some reasons, the issue causing |
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
Yep tried on the latest artifact and it's gone and time is 1:22 minutes on startup and 13 on second , scanning being pretty fast etc..load being again just the tps scene not being cached, great improvement. Feel free to close this one when it gets merged. Edit also this exact scan is the same on a project where i duplicated the tps demo until the project got to 2.40 gb of files ( almost 5 gb total counting .godot it took 7:10 minutes on first startup 1 reload 40 seconds and third time 13 seconds scanning, all with file scan load instantly except startup certainly. |
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
Hey considering this is merged and seem’s to be fine working last i have tested, i think it would be good to close it already. |
This is disabling the logic added in godotengine#84974 which caused godotengine#94416. That issue still needs to be debugged further, but this works around the regression and should have minimal usability impact on Android.
Tested versions
Reproducible in godot 4.3 beta 3
System information
Sansung galaxy s23+
Issue description
While it sure the android editor is not made for big project with more than 300mb or 500 , it kind of weird than in the tps demo it takes just a minute to remove 1 file , meanwhile when going on play mode save all scenes doesn't take nearly as much , so that 's why i think this might be more or less a bug.
In other instance in the pc version in a igpu( rx vega 3) it works way faster to load the project or doing the same adjustments despite being 4 times slower than the s23 and even in vulkan the s23 is faster despite the drivers ineficences.
Prob partial fix
#93064 ?
Edit: testing it last artifact and it doesn't make much difference in performanxe when removing a resource or loading the scene
Steps to reproduce
Open a big project like the mrp of the tps demo modifed https://github.com/godotengine/tps-demo
Load the scene or try to remove files to notice the massive slowdown.
Minimal reproduction project (MRP)
"N/A" ( Too big for mrp, download the tps demo link) https://github.com/godotengine/tps-demo )
The text was updated successfully, but these errors were encountered: