indexofnotequals-vs-includes

Benchmark created by Gokulakrishna on


Setup

var items = [
        "jpg", "3fr",
        "ari", "arw",
        "bay",
        "crw", "cr2",
        "cap",
        "data", "dcs", "dcr", "dng",
        "drf",
        "eip", "erf",
        "fff",
        "iiq",
        "k25", "kdc",
        "mdc", "mef", "mos", "mrw",
        "nef", "nrw",
        "obm", "orf",
        "pef", "ptx", "pxn",
        "r3d", "raf", "raw", "rwl", "rw2", "rwz",
        "sr2", "srf", "srw",
        "tif",
        "x3f"
    ];

Test runner

Ready to run.

Testing in
TestOps/sec
Array.indexOf Equality check
items.indexOf("srf") > -1
items.indexOf("srfkkk") === -1
items.indexOf("x3f") > -1
ready
Array.includes
items.includes("srf") 
items.includes("srfkkk")
items.includes("x3f")
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Gokulakrishna on