Skip to content

Conversation

AlyAbdelmoneim
Copy link
Contributor

@AlyAbdelmoneim AlyAbdelmoneim commented Mar 14, 2025

Resolves #6032.

Description

What is the purpose of this pull request?

This pull request:

  • Addresses issue Fix JavaScript lint errors #6032 by implementing the necessary changes to improve the functionality of the feature, by using push instead of pre-allocating the memory.

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

I encountered an issue when running the linting process due to an error related to EditorConfig. The error message indicated that the "path" argument was invalid, specifically that it was undefined. I would appreciate any guidance on how to resolve this or improve the configuration for linting.

Other

During the commit process, an error occurred in the linting task related to EditorConfig. The error traceback indicated that the "path" argument was expected to be a string but was undefined, causing the linting task to fail. I manually resolved this issue and ran the commit successfully after ensuring the configuration was correct. Any feedback on improving the linting process would be helpful.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Tools Issue or pull request related to project tooling. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Mar 14, 2025
@stdlib-bot
Copy link
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

Copy link
Contributor

@stdlib-bot stdlib-bot left a comment

Choose a reason for hiding this comment

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

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

Notice the lint error message:

Using the new Array() constructor is not allowed; use an array literal with push instead

We want to use .push instead of pre-allocating space for all the elements.

@AlyAbdelmoneim
Copy link
Contributor Author

Also can you explain for me why using .push is better than pre-allocating ? I thought pre-allocating is better performance-wise.
Thank youu

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

LGTM

@kgryte
Copy link
Member

kgryte commented Mar 17, 2025

@AlyAbdelmoneim Re: perf. Not with Array. The reason is that new Array( N ) can put the returned value in dictionary mode which can significantly slow performance. Instead, it is advisable to use .push in order to ensure "fast" mode and contiguous elements.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Mar 17, 2025
@kgryte kgryte merged commit 7f639d3 into stdlib-js:develop Mar 17, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Good First PR A pull request resolving a Good First Issue. Tools Issue or pull request related to project tooling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix JavaScript lint errors

4 participants