-
-
Notifications
You must be signed in to change notification settings - Fork 19.8k
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
'Save before running' option in editor can greatly affect the speed of starting a run #78753
Comments
What are the file sizes of the scene files currently open in the editor? If they take a while to save, they may contain embedded binary data which slows down saving and loading. Move this binary data to external
The reason we don't do this is that the "dirty" marking isn't 100% reliable: godotengine/godot-proposals#2153 |
They are all pretty small, none of them is bigger than 300KB. It doesn't make such a huge difference after I restart my computer, but the difference is still noticeable. |
See my above comment: #78753 (comment)
You can see a progress dialog when scenes are saving, regardless of what triggered the save. PS: In the future, please use the Edit button (located behind the … icon in the top-right corner of your comments) instead of multi-posting. |
Whoops, not sure how I missed that comment :)
The dialog doesn't show up during the long ~45 second wait, only for ~1 second at the very end. Maybe that's a regression? This is a screen recording with less scenes loaded that only takes ~10 seconds or so what you can still see that the dialog only shows at the very end:
Thanks, done! Update: I looked at the code and it looks like the EditorProgress is only shown in _save_scene_with_preview(): Line 1604 in 3524346
And we only call _save_scene_with_preview() for the scene currently being edited: Line 1936 in 3524346
In my case, I had 56 scenes to save through without any indication at all, and only when it reached the 57th quickly showed the save dialog. |
This slows down compilation time a lot. It's a shame that it's going unnoticed since it only affects people with larger projects. The solution is to make it skip saving the scenes that haven't been edited, but yeah it looks like that's not easy. |
I've just come across this post while investigating why my game sometimes takes ages to start and then takes ages for the editor to become responsive after I close the game. Sometimes it takes a few seconds, sometimes it takes 20+ seconds. As soon as I turned off the 'save before running' option, the game started up instantly, and the editor was also responsive straight away when I closed the game. The strange thing is, if I manually save my game before running it, it only takes a second or two, so the actual saving of the scene(s) doesn't appear to be the issue. I tried running the editor with the --verbose flag to see exactly what was going on, and the bottleneck appeared to be the generation of previews for various files, usually materials. I think this might be a red herring though, as I tried modifying the engine so that the preview generation was skipped, and the editor still took a long time to start/stop the game, and the verbose output didn't display anything suspicious either. So I guess my question would be: what exactly is the auto save feature doing that manual saving isn't? |
Saving resources is fast, especially on SSDs, as they are usually small. The problem is that it triggers slow tasks after they are saved, some of them multiple times without need. From the source, it looks like many of the resource editors don't have a mechanism to track, save, and update only the changed so auto-saving causes redundancy and performance-intensive things to happen all at once. Most of the slow-down in my project is caused by updating the script data: #92914 |
Godot version
4.1 beta3
System information
Windows 11
Issue description
I've recently found the startup of running projects to be unbearably slow. Sometimes the editor would hang for like ~40s from the time I pressed the run button until I saw the actual game window.
After doing some research, I found that if I didn't have any of the scenes open in the editor, then I would get instantaneous startup speeds. The more scenes that are open in the editor, the slower it is to start the game.
I further found that disabling the 'save before running' option would give me almost the same startup speed as not having any scenes open while having a large number of scenes open.
I find it strange that even if none of the scenes have changed, enabling the 'save before running' option will save them all over again. I guess this affects the speed of the startup. I think it might be better to skip saving scenes that haven't changed.
no scene opened:
![Godot_v4 1-beta3_win64_hzXmzFfllc](https://private-user-images.githubusercontent.com/40604180/249187999-0c7bdd6b-4c07-436c-88a5-5d0afb28936e.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzMjc0NDcsIm5iZiI6MTcyMzMyNzE0NywicGF0aCI6Ii80MDYwNDE4MC8yNDkxODc5OTktMGM3YmRkNmItNGMwNy00MzZjLTg4YTUtNWQwYWZiMjg5MzZlLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEwVDIxNTkwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxZjVhZjZlZDgwNTQyNTM1NTE2YTg4NjllNGZiMzg0MDRhNDEyMjY4MzgyZWIwYTE4MzJiOTBiNDU1MzYwOGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2W2gNVld27SBrLh4DVqwn9aQAX5YuhE2WNvL3u558Jk)
9 scenes opened and 'Save before running' on (~30s):
![Godot_v4 1-beta3_win64_8ijcaF5Z0r](https://private-user-images.githubusercontent.com/40604180/249189384-b6e8dbfd-2a5b-4048-9069-6bbdad99ef38.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzMjc0NDcsIm5iZiI6MTcyMzMyNzE0NywicGF0aCI6Ii80MDYwNDE4MC8yNDkxODkzODQtYjZlOGRiZmQtMmE1Yi00MDQ4LTkwNjktNmJiZGFkOTllZjM4LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEwVDIxNTkwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyYmJkODRlMjJjMjFlNmJlMjdjZDVjMGQwMzQ0NzE4MTk3ZmMzMzFhY2M3NjI0ZGJiMjc5M2E4MmM4ODcxNjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Zco7GBhSZ0loRnBIOkUMb57ac9D8gyRhvrnkBy9QDBo)
9 scenes opened and 'Save before running' off:
![Godot_v4 1-beta3_win64_smMKD2tYpm](https://private-user-images.githubusercontent.com/40604180/249189854-0be883e2-66b8-42e2-9d68-ac1978e3a199.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzMjc0NDcsIm5iZiI6MTcyMzMyNzE0NywicGF0aCI6Ii80MDYwNDE4MC8yNDkxODk4NTQtMGJlODgzZTItNjZiOC00MmUyLTlkNjgtYWMxOTc4ZTNhMTk5LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEwVDIxNTkwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBlMjJmOWJlZjc5NTQxOTI4YWI2NDNhMWQxYTRiZWY3YzAxYjhiYzU4ZTM4NmU4MTQ0ZTE5OTA5M2QwMzQwMDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Yf_lteuKezWSZrqZNMqCwDrbXKYW_4ckFK9c-hIrFXY)
There are some gif compression issues, but I think they are enough to illustrate what I mean.
Steps to reproduce
Minimal reproduction project
N/A
In a small project, it may not make a significant difference, so it is difficult to produce an MRP.
The text was updated successfully, but these errors were encountered: