Perf: Use of sort and sorted functions optimized #748

Merged
g1tman merged 8 commits from master into master 2019-11-25 11:28:17 +01:00
g1tman commented 2019-10-31 12:07:41 +01:00 (Migrated from github.com)

sorted function has been replaced with sort function wherever possible. It is faster and more readable than sorted function.

min function has been used instead of sorting and then picking the first element. Again, it will be faster and more readable.

PR Checklist

Please check all that apply to this PR using "x":

  • I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
  • I have checked that this PR does not introduce a breaking change
  • This PR introduces breaking changes and I have provided a detailed explanation below

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting)
  • Refactoring (no functional changes)
  • Documentation changes
  • Other - Please describe:
sorted function has been replaced with sort function wherever possible. It is faster and more readable than sorted function. min function has been used instead of sorting and then picking the first element. Again, it will be faster and more readable. ## PR Checklist <!-- For the checkbox formatting to work properly, make sure there are no spaces on either side of the "x" --> Please check all that apply to this PR using "x": - [x] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged) - [x] I have checked that this PR does not introduce a breaking change - [ ] This PR introduces breaking changes and I have provided a detailed explanation below ## PR Type What kind of change does this PR introduce? - [ ] Bugfix - [ ] Feature - [x] Code style update (formatting) - [x] Refactoring (no functional changes) - [ ] Documentation changes - [ ] Other - Please describe:
tzarebczan commented 2019-10-31 15:28:44 +01:00 (Migrated from github.com)

Thanks for the PR @g1, congrats on the first contribution! What was the motivation behind this? Did you notice any improvements in the overall usage of the app? We'll get this reviewed soon.

Can we show you some appreciation for the contribution?

Thanks for the PR @g1, congrats on the first contribution! What was the motivation behind this? Did you notice any improvements in the overall usage of the app? We'll get this reviewed soon. Can we show you some [appreciation for the contribution](https://lbry.com/faq/appreciation)?
g1tman commented 2019-11-03 13:11:58 +01:00 (Migrated from github.com)

Thanks for the PR @g1, congrats on the first contribution! What was the motivation behind this? Did you notice any improvements in the overall usage of the app? We'll get this reviewed soon.

Can we show you some appreciation for the contribution?

There won't be much observable time change.

Anyways, Execution time of sort function is better than sorted.
And obviously min function is much faster than sorting and then picking first element (former is O(n), second one is O(nlogn).

> Thanks for the PR @g1, congrats on the first contribution! What was the motivation behind this? Did you notice any improvements in the overall usage of the app? We'll get this reviewed soon. > > Can we show you some [appreciation for the contribution](https://lbry.com/faq/appreciation)? There won't be much observable time change. Anyways, Execution time of sort function is better than sorted. And obviously min function is much faster than sorting and then picking first element (former is O(n), second one is O(nlogn).
kauffj commented 2019-11-04 19:48:17 +01:00 (Migrated from github.com)

Thanks a lot @g1tman! Hope to see more of you in the future!

Thanks a lot @g1tman! Hope to see more of you in the future!
akinwale (Migrated from github.com) approved these changes 2019-11-25 11:28:09 +01:00
akinwale (Migrated from github.com) left a comment

Tested, and it works great. Thank you.

Tested, and it works great. Thank you.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-android#748
No description provided.