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

Optimizing JS Javascript globally #3

Open
ImprovedTube opened this issue Dec 1, 2023 Discussed in #2 · 0 comments
Open

Optimizing JS Javascript globally #3

ImprovedTube opened this issue Dec 1, 2023 Discussed in #2 · 0 comments

Comments

@ImprovedTube
Copy link
Member

ImprovedTube commented Dec 1, 2023

Discussed in #2

Originally posted by dodieboy August 22, 2021
Hey, I will like to suggest to use includes() instate of indexOf() in your code when you are checking if the item exist. include() will be better in that case as you do not use the return int value of indexOf(), all you want is true or false which is what include() return.
Since it return true or false, equal operator is not needed (improve performance) and it is a Boolean (1 bit) which use lesser memory compare to int which is 16 bit.

Here is a performance test that I did: https://www.measurethat.net/Benchmarks/ShowResult/215464

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

No branches or pull requests

1 participant