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

Optimising the DB Search #4388

Closed
wants to merge 5 commits into from

Conversation

Rustix69
Copy link

@Rustix69 Rustix69 commented Dec 7, 2024

Advantages :

  • Fixes : Slow call to olmMachine.getRoomSettings() #4337
  • Instead of calling object_store and get separately in different lines, the code groups them together in a single chain. This makes the code more concise and improves readability.
  • The ? operator is used after each method to propagate errors immediately if any of the calls fail, avoiding unnecessary logic or nesting.
  • We avoid multiple method calls and unnecessary intermediate variables. The result of get() is directly assigned, which will later be handled by the map() and transpose() methods.

@Rustix69 Rustix69 requested a review from a team as a code owner December 7, 2024 18:36
@Rustix69 Rustix69 requested review from andybalaam and removed request for a team December 7, 2024 18:36
Copy link

codecov bot commented Dec 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.28%. Comparing base (0264e49) to head (28f55d0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4388   +/-   ##
=======================================
  Coverage   85.27%   85.28%           
=======================================
  Files         282      282           
  Lines       31209    31209           
=======================================
+ Hits        26615    26618    +3     
+ Misses       4594     4591    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Rustix69 Rustix69 changed the title Optimising the Db search by cache Optimising the DB Search Dec 7, 2024
@poljar poljar requested review from poljar and removed request for andybalaam December 9, 2024 08:54
Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

Thanks for the patch, but I don't see how it changes anything to the actual code.

@Rustix69
Copy link
Author

Rustix69 commented Dec 9, 2024

Thanks for the patch, but I don't see how it changes anything to the actual code.

Actually this PR is improving the readability and the error handling of the process which somewhat improving its optimization.

We can use Cache Memory by Hashmaps to improve the DB calls should I go with that method ?

@Hywan
Copy link
Member

Hywan commented Dec 9, 2024

Actually this PR is improving the readability and the error handling of the process which somewhat improving its optimization.

I need proof of that. Readibility, yes, a bit, but I'm not sure it improves optimization from the compiler. From the compiler point of view, once reduced to a simple form, there is no difference between the two versions.

@Rustix69
Copy link
Author

Rustix69 commented Dec 9, 2024

Actually this PR is improving the readability and the error handling of the process which somewhat improving its optimization.

I need proof of that. Readibility, yes, a bit, but I'm not sure it improves optimization from the compiler. From the compiler point of view, once reduced to a simple form, there is no difference between the two versions.

Sir Can I use Cache Hashmaps to improve optimization ?

@Hywan
Copy link
Member

Hywan commented Dec 9, 2024

You can try for sure. I cannot merge this PR since it doesn't do anything useful and clearly not what the description claims.

@Rustix69 Rustix69 closed this Dec 11, 2024
@Rustix69 Rustix69 deleted the feature/slow-call-cache branch December 11, 2024 17:38
@Rustix69 Rustix69 restored the feature/slow-call-cache branch December 11, 2024 17:38
@Rustix69 Rustix69 reopened this Dec 11, 2024
@bnjbvr bnjbvr closed this Dec 11, 2024
@Rustix69 Rustix69 deleted the feature/slow-call-cache branch December 11, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slow call to olmMachine.getRoomSettings()
3 participants