-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
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
Labels
No labels