Skip to content
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

Extreme Android slowdown when copying files with scoped storage #62969

Closed
ondesic opened this issue Jul 13, 2022 · 8 comments · Fixed by #63242
Closed

Extreme Android slowdown when copying files with scoped storage #62969

ondesic opened this issue Jul 13, 2022 · 8 comments · Fixed by #63242

Comments

@ondesic
Copy link

ondesic commented Jul 13, 2022

Godot version

3.5 rc6

System information

Windows 11

Issue description

If I copy a file over to the "user://" directory, it takes 65 milliseconds.
However, If I allow permission to Manage_External_Storage, Read_External_Storage and Write_External_Stoage I can copy a file to a new directory int the Documents folder...yet, doing so takes over 5000 milliseconds!

Though this slowdown may also occur with other instances of trying to use a file in storage, this extreme slowdown for sure occurs with file copying.

Steps to reproduce

Take turns commenting out line 21 and 22. One uses the "user://" directory, the other uses the phone's regular storage.
Make sure each time you install it, you allow and accept the two permissions, then close and run again to see effects.

Minimal reproduction project

I usually use C#, but made it in GDScript to speed up the testing.
Storage.zip

@Calinou
Copy link
Member

Calinou commented Jul 13, 2022

cc @m4gr3d

@m4gr3d
Copy link
Contributor

m4gr3d commented Jul 13, 2022

@ondesic Do you have a reference for the time it takes to perform a copy on versions of the release candidate prior to the scoped storage inclusion (or on the current stable version)?

@m4gr3d m4gr3d self-assigned this Jul 13, 2022
@m4gr3d m4gr3d added this to the 3.5 milestone Jul 13, 2022
@ondesic
Copy link
Author

ondesic commented Jul 13, 2022

@m4gr3d I don't have an exact number, but before the inclusion, the app started as fast with using storage as the "user://" version did. I would say close to 65.

@m4gr3d
Copy link
Contributor

m4gr3d commented Jul 22, 2022

@ondesic Thanks for uncovering the issue and providing an easy repro project!
This was key in helping me quickly track the regression.

Don't hesitate to open other issues if you encounter further regressions.

@ondesic
Copy link
Author

ondesic commented Jul 22, 2022

@m4gr3d Oh no. More Scoped Storage bugs. Using the same project, uncomment the button code. Now, once again take turns commenting out line 21 and 22. One uses the "user://" directory, the other uses the phone's regular storage.
Make sure each time you install it, you allow and accept the two permissions, then close and run again to see effects.

Press the button and watch how long it takes to execute the simple file code. With the "user://" directory the code runs as fast as the desktop. With Scoped Storage it takes over 5 sec.

PS. I can open a new issue if you would like.

@madmiraal
Copy link
Contributor

@ondesic, Have you tested it with #63242? If it's not fixed with #63242, then yes, you should open a new issue.

@ondesic
Copy link
Author

ondesic commented Jul 25, 2022

@madmiraal I'm sorry, i don't know how to test this. Is there some code i need to use before trying to access the content of a file in storage?
All I know is that with the latest 3.5 rc7, if I try to access a file's content in scoped storage, it bogs down the app to a crawl. Copy Dir had been fixed though so I am hoping the fix can be applied to reading and writing files in scoped storage..

@madmiraal
Copy link
Contributor

@ondesic, @akien-mga should be able to confirm, but as far as I know, #63242 was included in RC7. So, yes I'd open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment