Skip to content

Optimizing JS Javascript globally #3

@ImprovedTube

Description

@ImprovedTube

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions