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

Improved the code and speed of ToStorageItem<TOut>() #4346

Merged
merged 6 commits into from
Mar 30, 2021

Conversation

d2dyno1
Copy link
Member

@d2dyno1 d2dyno1 commented Mar 28, 2021

Details of Changes
This PR improves the code and speed of ToStorageItem<TOut>().
Since getting instances of StorageFile and StorageFolder is resource heavy and slow, this PR mitigates the performance hole as much as possible.
Bundles widget heavily relies on this function and the performance increase is very noticeable (It's "you could test debug app against release app" noticeable)

For #4180

Validation
How did you test these changes?

  • Built and ran the app
  • Tested the changes for accessibility

@d2dyno1 d2dyno1 marked this pull request as draft March 28, 2021 21:00
@d2dyno1 d2dyno1 marked this pull request as ready for review March 28, 2021 21:28
@d2dyno1 d2dyno1 changed the title Improve the code for ToStorageItem<TOut>() Improve the code and speed of ToStorageItem<TOut>() Mar 28, 2021
@d2dyno1 d2dyno1 changed the title Improve the code and speed of ToStorageItem<TOut>() Improved the code and speed of ToStorageItem<TOut>() Mar 28, 2021
@d2dyno1
Copy link
Member Author

d2dyno1 commented Mar 28, 2021

Ready!

@lukeblevins lukeblevins self-requested a review March 28, 2021 22:39
lukeblevins
lukeblevins previously approved these changes Mar 28, 2021
Copy link
Contributor

@lukeblevins lukeblevins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. For those unfamiliar, @d2dyno1 and I discussed privately in chat how this PR reduces the calls to intensive functions pertaining to filesystem access.

@lukeblevins lukeblevins requested a review from gave92 March 28, 2021 23:09
@d2dyno1
Copy link
Member Author

d2dyno1 commented Mar 29, 2021

@duke7553

For this configuration:
image

Old logic (time in miliseconds, error unknown, DEBUG, performed using Stopwatch class):

0: 586
1: 439
2: 472
3: 735
4: 786
5: 715
6: 730
7: 764
8: 774
9: 736
10: 51
11: 76
12: 70
13: 73
14: 746
15: 717
16: 49
17: 75
18: 69
19: 76
20: 70
21: 83
22: 77
23: 76
24: 69
25: 57
26: 704
27: 53
28: 77
29: 70
30: 76
31: 70
32: 72

(lower is better)

New logic (time in miliseconds, error unknown, DEBUG, performed using Stopwatch class):
(Note that the new method didn't throw any exceptions whereas with old logic exceptions were present)

0: 85
1: 144
2: 85
3: 0
4: 0
5: 0
6: 0
7: 0
8: 0
9: 0
10: 175
11: 111
12: 105
13: 0
14: 0
15: 110
16: 96
17: 105
18: 98
19: 127
20: 121
21: 78
22: 71
23: 78
24: 72
25: 0
26: 75
27: 68
28: 71
29: 92
30: 84
31: 77
32: 62

(lower is better)

@yaira2 yaira2 requested a review from lukeblevins March 30, 2021 14:38
@lukeblevins lukeblevins added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Mar 30, 2021
@yaira2 yaira2 merged commit 2f14f59 into files-community:main Mar 30, 2021
@d2dyno1 d2dyno1 deleted the imp_tostorageitem branch April 5, 2021 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants