-
Notifications
You must be signed in to change notification settings - Fork 41
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
Improve performance for async functions #29
Comments
i want to work on this issue , can you assign it to me. |
This is a good issue and open for contributions, make sure to checkout our sdk generator repo and raise a PR there - https://github.com/appwrite/sdk-generator |
Hello @ChiragAgg5k , might be really helpful if you could confirm the need of resolving this issue. |
@sahilsekr42 the issue is still open for contribution! feel free to open a pr on the sdk generator repository. Make sure to read the guidelines before making the PR. Would also greatly appreciate if you can link the benchmark results before and after making the changes. |
Ok , on it. and thanks for quick reply . |
Hey @ChiragAgg5k, I performed this little experiment of compiling and building 2 versions of the node-sdk. Then packaging and importing both versions into Node projects running the same backend code ( which was basically adding documents to an existing appwrite database collection ). The only change that I did in both the versions was removed the redundant async await function from createDocument. Then I performed the tests for different number of documents similar to what was recommended by @JulienLecoq . Here are results (in ms) for comparision :-- 1749.131 vs 1532.828 ; 119.339 vs 109.946 ; 160.056 vs 147.534 ; 171.254 vs 152.308 |
Performing similar steps for benchmarking create user functions for auth I observed improvement of around 9% just by removing a couple of async/await. Should I first raise an issue then PR in sdk-generator repo now ? @ChiragAgg5k |
@sahilsekr42 feel free to create the PR directly and link this issue in the PR. Thanks for the benchmark numbers, they look really promising 😄 |
In some async functions, you're using redundant code that makes the execution code slower (I assume that this is also valid for the deno sdk). I didn't new at first that this redundant code could make the execution slower, but I tested it and here is my experience/results.
In some async functions, you're using the following pattern (from /lib/services/account.js):
This pattern contains an unnecessary "async" and "await" notation.
This could be simplified by:
From this pov, I decided to benchmark the 2 solutions with the following script:
The results are (with Node v17.4.0):
I haven't tested with the sdk itself, but with a simple script, the second solution (without "async" and "await" notation) seems 1.74 times faster than the first one. I should have tested with the sdk itself, but I don't really have time for that rn.
The text was updated successfully, but these errors were encountered: