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

Implement TypedArray.prototype.toSorted #1367

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

robik
Copy link
Contributor

@robik robik commented Mar 29, 2024

Summary

This PR implements ES2023 TypedArray.prototype.toSorted method.

See also:

I am creating separate PRs for each method in case there are any suggestions or change requests from your side, so that PRs are more independent.

Test Plan

Code is annotated with algorithm steps from EcmaScript specification for easier verification and maintenance.
I also added tests to verify that methods work as intended. There might be some more edge cases that might be covered based on your experience.

$ echo "new Int8Array([3, 1, 2]).toSorted()" | ./bin/hermes
# >> Int8Array [ 1, 2, 3 ]

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 29, 2024
@robik robik force-pushed the typed-array-es14-to-sorted branch from 43fb55a to 47c7b55 Compare June 20, 2024 18:41
@robik
Copy link
Contributor Author

robik commented Jun 28, 2024

Considering comments from other PRs, I wonder if I could optimize TypedArraySortModel to use direct access to values rather than using VTable. WDYT?

@robik robik force-pushed the typed-array-es14-to-sorted branch from 47c7b55 to ea1e6ac Compare June 28, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants