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

Add benchmarks to test different memoization methods #640

Merged
merged 9 commits into from
Nov 28, 2023

Conversation

aryaemami59
Copy link
Contributor

This PR aims to:

  • Add benchmarks to test different memoization methods. This could serve as a guide for making informed decisions about potentially adjusting the configuration defaults.
  • Add benchmarks to test for potential memory leak related to weakMapMemoize (Investigate potential memory leak issues with weakmapMemoize #635).
  • Add benchmarks comparing weakMapMemoize and defaultMemoize particularly focusing on scenarios with a specified maxSize.
  • Add benchmarks to compare the effectiveness of different memoization methods when used as memoize versus argsMemoize.
  • Add utility functions in testUtils.ts to help setup benchmark suites.

- Only run benchmarks in production mode since input stability checks can skew the results.
- Add `IfUnknown` and `FallbackIfUnknown` utility types.
-  Modify `ExtractReturnType` to default to `any` when the function's return type is `unknown`.
  - This change facilitates the use of `OutputSelector` with any output selector type.
  - Prevents incompatible parameter type issues in `resultFunc` when generic parameters are not specified in `OutputSelector`.
- Most of the utility functions used for unit testing can also be used for benchmarks.
- Create benchmarks for `weakMapMemoize`
- Create benchmarks comparing all memoization methods.
- Add utility functions for benchmarks to `testUtils.ts`
- Add benchmarks to test for potential memory leak caused by `weakMapMemoize`
Copy link

codesandbox-ci bot commented Nov 20, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 844579c:

Sandbox Source
JavaScript Configuration
Vanilla Typescript Configuration

@aryaemami59 aryaemami59 marked this pull request as ready for review November 20, 2023 22:25
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.

2 participants