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

perf: Improve performance of recursive pointer iterations #8741

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

chderen
Copy link
Contributor

@chderen chderen commented Sep 11, 2023

Pull Request

Code change for performances.

Instead of creating and updating the answer array on each iterations, use map function.

Code change for performances.

Instead of creating and updating the answer array on each iterations, use map function.

Signed-off-by: Yechezkel Deren <chderen@gmail.com>
@parse-github-assistant
Copy link

parse-github-assistant bot commented Sep 11, 2023

Thanks for opening this pull request!

  • ❌ Please link an issue that describes the reason for this pull request, otherwise your pull request will be closed. Make sure to write it as Closes: #123 in the PR description, so I can recognize it.

@chderen chderen changed the title Update RestQuery.js refactor: Update in RestQuery.js Sep 11, 2023
@mtrezza
Copy link
Member

mtrezza commented Sep 11, 2023

Do you have any proof that this is actually better performing and not worse?

@chderen
Copy link
Contributor Author

chderen commented Sep 11, 2023

I tested on my computer. for arrays grater then 1000 there is a big diff

Signed-off-by: Yechezkel Deren <chderen@gmail.com>
@mtrezza
Copy link
Member

mtrezza commented Sep 12, 2023

Could you share the metrics and tool you used for performance measurement? There may be factors in the test set-up that would need to be considered (caching, etc) to know how reliable the test results are.

@chderen
Copy link
Contributor Author

chderen commented Sep 12, 2023

I have isolated the relevant code, and created a test here https://jsbench.me/talmgdggir/1

Copy link
Member

@mtrezza mtrezza 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 sharing the performance test; looks good. Maybe you can improve the PR title to explain the improvement in more practical terms.

@mtrezza mtrezza changed the title refactor: Update in RestQuery.js perf: Imrpove performance of recursive pointer iterations in RestQuery.js Sep 12, 2023
@mtrezza mtrezza changed the title perf: Imrpove performance of recursive pointer iterations in RestQuery.js perf: Improve performance of recursive pointer iterations in RestQuery.js Sep 12, 2023
@mtrezza mtrezza changed the title perf: Improve performance of recursive pointer iterations in RestQuery.js perf: Improve performance of recursive pointer iterations in RestQuery.js Sep 13, 2023
@mtrezza mtrezza changed the title perf: Improve performance of recursive pointer iterations in RestQuery.js perf: Improve performance of recursive pointer iterations Sep 13, 2023
@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -6.86% ⚠️

Comparison is base (977edea) 94.32% compared to head (3e65d8a) 87.46%.

❗ Current head 3e65d8a differs from pull request most recent head b596a9d. Consider uploading reports for the commit b596a9d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #8741      +/-   ##
==========================================
- Coverage   94.32%   87.46%   -6.86%     
==========================================
  Files         186      186              
  Lines       14773    14770       -3     
==========================================
- Hits        13935    12919    -1016     
- Misses        838     1851    +1013     
Files Changed Coverage Δ
src/RestQuery.js 92.79% <100.00%> (-2.91%) ⬇️

... and 28 files with indirect coverage changes

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

@mtrezza mtrezza merged commit 45a3ed0 into parse-community:alpha Sep 13, 2023
24 checks passed
parseplatformorg pushed a commit that referenced this pull request Sep 13, 2023
# [6.3.0-alpha.9](6.3.0-alpha.8...6.3.0-alpha.9) (2023-09-13)

### Performance Improvements

* Improve performance of recursive pointer iterations ([#8741](#8741)) ([45a3ed0](45a3ed0))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.3.0-alpha.9

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Sep 13, 2023
@chderen chderen deleted the patch-1 branch September 13, 2023 12:21
parseplatformorg pushed a commit that referenced this pull request Sep 16, 2023
# [6.4.0-beta.1](6.3.0...6.4.0-beta.1) (2023-09-16)

### Bug Fixes

* Parse Server option `fileUpload.fileExtensions` does not work with an array of extensions ([#8688](#8688)) ([6a4a00c](6a4a00c))
* Redis 4 does not reconnect after unhandled error ([#8706](#8706)) ([2b3d4e5](2b3d4e5))
* Remove config logging when launching Parse Server via CLI ([#8710](#8710)) ([ae68f0c](ae68f0c))
* Server does not start via CLI when `auth` option is set ([#8666](#8666)) ([4e2000b](4e2000b))

### Features

* Add conditional email verification via dynamic Parse Server options `verifyUserEmails`, `sendUserEmailVerification` that now accept functions ([#8425](#8425)) ([44acd6d](44acd6d))
* Add property `Parse.Server.version` to determine current version of Parse Server in Cloud Code ([#8670](#8670)) ([a9d376b](a9d376b))
* Add TOTP authentication adapter ([#8457](#8457)) ([cc079a4](cc079a4))

### Performance Improvements

* Improve performance of recursive pointer iterations ([#8741](#8741)) ([45a3ed0](45a3ed0))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.4.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Sep 16, 2023
ashish-naik added a commit to ashish-naik/parse-server-FB-signup-error206 that referenced this pull request Sep 19, 2023
* commit 'b1e1bf6708f5d32b2846e66de40f48fb0ec1dc86':
  chore(release): 6.4.0-beta.1 [skip ci]
  release
  chore(release): 6.3.0 [skip ci]
  release
  chore(release): 6.3.0-alpha.9 [skip ci]
  perf: Improve performance of recursive pointer iterations (parse-community#8741)
  refactor: Parse Pointer allows to access internal Parse Server classes and circumvent `beforeFind` query trigger (parse-community#8734)
  chore(release): 6.2.2 [skip ci]
  fix: Parse Pointer allows to access internal Parse Server classes and circumvent `beforeFind` query trigger; fixes security vulnerability [GHSA-fcv6-fg5r-jm9q](GHSA-fcv6-fg5r-jm9q)
  refactor: Remote code execution via MongoDB BSON parser through prototype pollution; fixes security vulnerability [GHSA-462x-c3jw-7vr6](GHSA-462x-c3jw-7vr6) (parse-community#8677)
  chore(release): 6.2.1 [skip ci]
  fix: Remote code execution via MongoDB BSON parser through prototype pollution; fixes security vulnerability [GHSA-462x-c3jw-7vr6](GHSA-462x-c3jw-7vr6) (parse-community#8674)
  refactor: Add option to convert `Parse.Object` to instance in Cloud Function payload (parse-community#8656)
parseplatformorg pushed a commit that referenced this pull request Sep 20, 2023
# [6.4.0-alpha.1](6.3.0...6.4.0-alpha.1) (2023-09-20)

### Bug Fixes

* Parse Server option `fileUpload.fileExtensions` does not work with an array of extensions ([#8688](#8688)) ([6a4a00c](6a4a00c))
* Redis 4 does not reconnect after unhandled error ([#8706](#8706)) ([2b3d4e5](2b3d4e5))
* Remove config logging when launching Parse Server via CLI ([#8710](#8710)) ([ae68f0c](ae68f0c))
* Server does not start via CLI when `auth` option is set ([#8666](#8666)) ([4e2000b](4e2000b))

### Features

* Add conditional email verification via dynamic Parse Server options `verifyUserEmails`, `sendUserEmailVerification` that now accept functions ([#8425](#8425)) ([44acd6d](44acd6d))
* Add context to Cloud Code Triggers `beforeLogin` and `afterLogin` ([#8724](#8724)) ([a9c34ef](a9c34ef))
* Add property `Parse.Server.version` to determine current version of Parse Server in Cloud Code ([#8670](#8670)) ([a9d376b](a9d376b))
* Add TOTP authentication adapter ([#8457](#8457)) ([cc079a4](cc079a4))

### Performance Improvements

* Improve performance of recursive pointer iterations ([#8741](#8741)) ([45a3ed0](45a3ed0))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.4.0-alpha.1

parseplatformorg pushed a commit that referenced this pull request Nov 16, 2023
# [6.4.0](6.3.1...6.4.0) (2023-11-16)

### Bug Fixes

* Parse Server option `fileUpload.fileExtensions` does not work with an array of extensions ([#8688](#8688)) ([6a4a00c](6a4a00c))
* Redis 4 does not reconnect after unhandled error ([#8706](#8706)) ([2b3d4e5](2b3d4e5))
* Remove config logging when launching Parse Server via CLI ([#8710](#8710)) ([ae68f0c](ae68f0c))
* Server does not start via CLI when `auth` option is set ([#8666](#8666)) ([4e2000b](4e2000b))

### Features

* Add conditional email verification via dynamic Parse Server options `verifyUserEmails`, `sendUserEmailVerification` that now accept functions ([#8425](#8425)) ([44acd6d](44acd6d))
* Add property `Parse.Server.version` to determine current version of Parse Server in Cloud Code ([#8670](#8670)) ([a9d376b](a9d376b))
* Add TOTP authentication adapter ([#8457](#8457)) ([cc079a4](cc079a4))

### Performance Improvements

* Improve performance of recursive pointer iterations ([#8741](#8741)) ([45a3ed0](45a3ed0))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.4.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants