==と===のまとめ
高速化 - uupaaの開発日記で==よりも===が良いと知る。 ↓ 早速実験するけど、速くならないよ、と記事を書いた。 ↓ 等価演算子と厳密等価演算子 in ECMA-262 3rd Edition - 0x集積蔵で型が違えば、厳密等価演算子の方が有利だと説明があった。 ↓ 納得しつつ、同じ型ならどうかと試して、記事の結論に達する。 ↓ プラシーボ効果はもちろんご存知ですよね? - uupaaの開発日記でベンチの取り方のまずさ込みで結果の間違いが指摘される。 ↓ この記事で再度ベンチマーク結果を貼る。
結論
IEでもFxでも同じ型の場合、厳密等価演算子の方がごく僅かに速い(PHPほど明瞭な差は見られない)。型が違えば、型を類推する機能が働くことから、(もちろん得られる結果は変わるが(6=="6"、6!=="6"))厳密等価演算子の方が速く動作する。ただ、今回結果には書いていないが、計測した結果、(まぁ当然だが)v=="6"の方がv===6||v==="6"より速い。個人的にはv!=null(またはv!=undefined)がv!==null&&v!==undefinedなのを初めて知ったので、v!=nullの方が速いし、スマートなので、こちらを使いたいと思った。
あと、評価する値は右でも左でも(v === 1でも1 === vでも)結果に差異があるようには見られなかった。
ベンチの結果
下に示したベンチ用のコードから一つ一つ、計測用のファイルを作って、五回実行した値を貼って成形しています。v === 1を、Number === Number(L)、1 === vを、Number(L) === Numberという風に書いています。
IE6
Number === Number(L) 200, 200, 210, 211, 200, 210, 201, 210, 210, 200, 200, 200, 221, 200, 210, 211, 210, 210, 231, 220, 211, 210, 200, 201, 220, 200, 200, 211, 200, 210, 210, 210, 221, 210, 200, 200, 211, 210, 200, 211, 201, 210, 210, 200, 201, 210, 210, 201, 210, 200, Number(L) === Number 201, 210, 200, 211, 210, 200, 210, 201, 220, 200, 210, 200, 210, 201, 210, 210, 201, 210, 200, 221, 210, 200, 211, 210, 200, 210, 201, 210, 210, 201, 200, 200, 201, 210, 200, 211, 200, 200, 210, 211, 210, 201, 210, 200, 211, 210, 200, 210, 201, 210, -------------------------------------------------- Number === String(L) 231, 230, 230, 231, 490, 231, 230, 341, 310, 290, 230, 241, 230, 240, 401, 230, 240, 231, 230, 230, 230, 230, 241, 230, 391, 230, 240, 241, 230, 240, 240, 240, 241, 250, 240, 401, 230, 231, 240, 230, 241, 230, 240, 231, 240, 411, 230, 240, 231, 240, String(L) === Number 231, 230, 240, 241, 400, 230, 241, 230, 230, 231, 240, 240, 241, 230, 411, 240, 230, 231, 240, 240, 240, 231, 230, 230, 231, 410, 231, 230, 230, 241, 230, 231, 240, 230, 231, 400, 241, 230, 230, 231, 231, 240, 230, 381, 230, 241, 230, 230, 241, 400, -------------------------------------------------- String === Number(L) 221, 210, 220, 220, 211, 220, 210, 221, 220, 220, 230, 221, 220, 210, 231, 220, 220, 221, 220, 230, 211, 230, 210, 221, 210, 220, 221, 210, 220, 211, 220, 210, 220, 221, 220, 220, 211, 220, 220, 221, 220, 221, 220, 220, 221, 210, 220, 221, 220, 220, Number(L) === String 221, 220, 220, 220, 221, 210, 220, 231, 210, 220, 221, 220, 220, 220, 211, 220, 220, 221, 220, 220, 220, 221, 220, 220, 231, 230, 220, 210, 221, 220, 220, 221, 220, 220, 210, 211, 220, 220, 221, 220, 220, 220, 221, 220, 220, 220, 221, 220, 220, 221, -------------------------------------------------- String === String(L) 290, 271, 280, 271, 460, 281, 270, 280, 281, 270, 270, 270, 281, 280, 451, 280, 281, 270, 270, 281, 270, 281, 270, 270, 461, 281, 270, 280, 281, 270, 280, 270, 291, 270, 451, 280, 271, 270, 280, 281, 270, 270, 291, 270, 471, 270, 281, 270, 281, 280, String(L) === String 281, 280, 270, 281, 461, 280, 280, 281, 280, 271, 271, 280, 280, 281, 460, 281, 280, 271, 280, 280, 291, 270, 280, 271, 460, 281, 280, 281, 280, 270, 291, 270, 280, 271, 460, 281, 270, 291, 270, 280, 281, 280, 270, 281, 450, 281, 270, 271, 280, 280, -------------------------------------------------- Any === Number(L) 210, 220, 211, 200, 210, 210, 211, 210, 210, 211, 220, 201, 210, 210, 211, 210, 210, 210, 211, 220, 220, 200, 211, 210, 210, 211, 210, 210, 211, 210, 210, 211, 210, 210, 200, 211, 220, 210, 211, 210, 211, 210, 210, 211, 210, 210, 210, 211, 220, 210, Number(L) === Any 211, 210, 210, 211, 210, 210, 211, 220, 210, 210, 210, 221, 200, 210, 210, 221, 200, 220, 211, 210, 210, 210, 211, 210, 210, 201, 210, 210, 211, 210, 210, 211, 210, 210, 211, 210, 210, 221, 210, 210, 210, 220, 211, 210, 210, 210, 211, 220, 210, 201, -------------------------------------------------- Any === String(L) 351, 420, 331, 420, 341, 410, 331, 421, 330, 431, 340, 421, 410, 341, 421, 330, 421, 330, 421, 330, 411, 330, 411, 320, 431, 330, 421, 331, 420, 411, 340, 411, 330, 431, 330, 421, 340, 411, 340, 421, 330, 411, 341, 410, 431, 330, 411, 340, 411, 330, String(L) === Any 341, 430, 331, 420, 351, 420, 341, 420, 331, 431, 340, 421, 331, 430, 341, 430, 411, 340, 431, 330, 430, 341, 420, 341, 440, 331, 430, 341, 421, 350, 410, 431, 340, 421, 350, 421, 350, 421, 341, 430, 351, 430, 341, 430, 341, 430, 331, 421, 420, 331, -------------------------------------------------- Any === String(S) 341, 420, 351, 430, 341, 431, 330, 441, 340, 421, 341, 430, 340, 431, 350, 411, 420, 341, 420, 341, 421, 330, 421, 330, 441, 330, 421, 340, 421, 330, 421, 430, 331, 420, 351, 430, 351, 431, 340, 431, 340, 431, 340, 431, 361, 420, 331, 420, 421, 340, String(S) === Any 330, 421, 331, 420, 341, 420, 331, 420, 331, 430, 340, 411, 330, 421, 341, 420, 421, 330, 431, 330, 421, 330, 421, 340, 431, 330, 421, 330, 431, 330, 421, 421, 330, 431, 340, 421, 340, 431, 330, 431, 340, 421, 330, 421, 341, 420, 331, 420, 411, 330,
Number == Number(L) 220, 210, 211, 210, 220, 211, 210, 210, 211, 210, 210, 211, 220, 210, 211, 210, 220, 211, 220, 210, 220, 211, 210, 210, 220, 211, 210, 210, 211, 210, 210, 220, 211, 210, 210, 221, 210, 210, 210, 211, 210, 211, 210, 220, 211, 220, 210, 210, 221, 210, Number(L) == Number 230, 210, 231, 210, 220, 221, 220, 210, 211, 220, 220, 210, 221, 210, 220, 221, 210, 220, 210, 211, 210, 220, 210, 211, 220, 210, 211, 220, 210, 211, 210, 221, 210, 210, 220, 211, 210, 210, 221, 210, 210, 211, 220, 210, 211, 220, 210, 220, 211, 210, -------------------------------------------------- Number == String(L) 291, 300, 290, 291, 451, 290, 310, 301, 300, 451, 301, 290, 290, 301, 440, 291, 300, 291, 290, 451, 290, 301, 290, 290, 461, 291, 290, 290, 301, 450, 300, 291, 290, 311, 440, 301, 300, 290, 301, 461, 301, 300, 291, 300, 451, 290, 301, 300, 290, 461, String(L) == Number 280, 281, 280, 281, 430, 291, 280, 280, 271, 440, 281, 270, 280, 291, 430, 281, 280, 281, 270, 441, 281, 280, 271, 300, 431, 400, 361, 280, 281, 440, 281, 270, 281, 280, 431, 270, 280, 281, 270, 451, 270, 291, 280, 280, 431, 291, 280, 280, 281, 440, -------------------------------------------------- String == Number(L) 260, 260, 271, 260, 260, 251, 260, 261, 250, 260, 250, 261, 250, 261, 260, 250, 271, 260, 250, 251, 250, 260, 261, 260, 260, 261, 260, 250, 261, 260, 270, 271, 250, 260, 271, 250, 271, 270, 260, 251, 260, 260, 261, 270, 261, 270, 270, 261, 260, 260, Number(L) == String 280, 270, 271, 280, 271, 270, 270, 281, 270, 270, 260, 270, 271, 270, 270, 271, 290, 271, 260, 280, 271, 270, 270, 281, 270, 271, 270, 270, 271, 270, 270, 270, 261, 270, 281, 270, 270, 271, 280, 261, 270, 271, 270, 271, 270, 270, 271, 260, 281, 270, -------------------------------------------------- String == String(L) 371, 461, 370, 471, 370, 461, 371, 470, 381, 470, 370, 461, 371, 470, 381, 460, 371, 471, 370, 461, 361, 461, 370, 461, 370, 461, 461, 370, 451, 370, 471, 370, 461, 381, 460, 371, 460, 371, 461, 370, 451, 470, 361, 470, 371, 461, 370, 461, 370, 461, String(L) == String 371, 471, 370, 471, 370, 471, 461, 370, 471, 370, 471, 381, 470, 391, 471, 370, 471, 370, 471, 371, 461, 471, 370, 481, 371, 470, 371, 470, 381, 461, 370, 461, 370, 471, 370, 461, 371, 470, 451, 371, 460, 371, 460, 381, 481, 450, 571, 371, 460, 371, -------------------------------------------------- Any == Number(L) 230, 241, 220, 230, 231, 240, 230, 231, 230, 230, 231, 230, 230, 241, 230, 230, 241, 230, 230, 231, 240, 231, 230, 230, 231, 240, 230, 241, 230, 230, 231, 230, 230, 231, 230, 240, 231, 230, 230, 241, 221, 230, 230, 231, 230, 230, 241, 230, 230, 231, Number(L) == Any 240, 241, 240, 241, 240, 240, 251, 240, 230, 241, 241, 230, 240, 241, 240, 240, 241, 240, 240, 241, 240, 251, 230, 240, 241, 240, 241, 240, 240, 241, 251, 230, 240, 241, 240, 240, 251, 240, 240, 241, 250, 230, 241, 240, 240, 241, 250, 241, 250, 240, -------------------------------------------------- Any == String(L) 360, 451, 361, 450, 361, 460, 371, 451, 370, 461, 351, 440, 351, 441, 350, 431, 430, 361, 430, 351, 431, 341, 440, 351, 460, 341, 441, 350, 431, 350, 441, 430, 361, 430, 371, 441, 350, 441, 350, 431, 350, 441, 340, 441, 360, 441, 340, 431, 441, 350, String(L) == Any 371, 431, 350, 451, 360, 441, 350, 451, 351, 430, 360, 431, 360, 451, 360, 431, 351, 450, 351, 440, 350, 451, 351, 450, 361, 450, 451, 351, 450, 361, 441, 350, 451, 350, 451, 350, 441, 361, 440, 351, 430, 441, 340, 441, 361, 430, 351, 440, 341, 450, -------------------------------------------------- Any == String(S) 360, 451, 361, 450, 361, 450, 361, 441, 360, 451, 350, 441, 340, 441, 360, 441, 441, 350, 451, 350, 430, 351, 440, 351, 441, 340, 441, 350, 441, 350, 360, 441, 350, 431, 360, 441, 350, 441, 351, 440, 351, 430, 361, 440, 351, 441, 350, 451, 350, 441, String(S) == Any 351, 430, 351, 571, 460, 441, 340, 431, 350, 421, 340, 421, 351, 420, 351, 440, 341, 430, 341, 431, 340, 441, 341, 430, 351, 430, 441, 350, 431, 341, 431, 340, 431, 340, 441, 351, 420, 351, 430, 341, 420, 441, 340, 431, 370, 431, 351, 420, 341, 430,
Fx3
Number === Number(L) 58, 58, 57, 57, 58, 57, 57, 58, 59, 57, 59, 58, 58, 64, 60, 61, 60, 59, 59, 58, 58, 58, 57, 58, 57, 58, 58, 57, 57, 57, 58, 58, 59, 58, 58, 62, 58, 60, 58, 59, 58, 57, 58, 58, 57, 57, 58, 59, 58, 58, Number(L) === Number 58, 58, 57, 58, 58, 58, 59, 59, 60, 59, 58, 58, 58, 62, 58, 58, 57, 58, 57, 58, 59, 58, 58, 58, 63, 58, 58, 58, 58, 58, 58, 58, 58, 57, 57, 58, 58, 57, 58, 57, 64, 58, 58, 58, 58, 57, 58, 57, 58, 57, -------------------------------------------------- Number === String(L) 58, 58, 60, 58, 59, 58, 58, 58, 57, 58, 59, 58, 58, 59, 60, 58, 59, 65, 59, 60, 59, 62, 60, 62, 60, 58, 61, 66, 58, 60, 59, 64, 58, 57, 57, 58, 58, 57, 57, 57, 58, 58, 58, 58, 59, 60, 59, 58, 58, 58, String(L) === Number 58, 58, 57, 58, 57, 57, 58, 57, 59, 59, 64, 57, 56, 57, 58, 57, 58, 57, 57, 57, 58, 57, 57, 57, 58, 57, 58, 57, 59, 57, 58, 57, 57, 58, 59, 58, 58, 59, 59, 65, 57, 57, 57, 59, 60, 60, 60, 60, 60, 60, -------------------------------------------------- String === Number(L) 57, 57, 57, 57, 57, 57, 57, 57, 58, 60, 57, 57, 56, 56, 58, 56, 56, 56, 56, 55, 57, 56, 57, 57, 56, 58, 57, 58, 57, 63, 57, 63, 58, 57, 57, 56, 57, 59, 58, 58, 59, 62, 57, 57, 57, 57, 59, 58, 58, 58, Number(L) === String 58, 59, 59, 61, 59, 58, 58, 58, 57, 57, 62, 59, 59, 58, 60, 59, 62, 61, 59, 58, 57, 58, 57, 57, 58, 57, 56, 57, 56, 57, 63, 57, 57, 56, 56, 58, 56, 57, 56, 56, 58, 63, 57, 56, 57, 57, 58, 57, 57, 57, -------------------------------------------------- String === String(L) 65, 65, 66, 65, 66, 65, 65, 66, 66, 66, 66, 65, 67, 65, 66, 67, 66, 65, 65, 68, 70, 68, 72, 68, 67, 65, 69, 69, 66, 70, 66, 66, 66, 67, 67, 71, 66, 66, 67, 67, 70, 65, 65, 66, 66, 66, 66, 65, 65, 66, String(L) === String 67, 66, 67, 71, 66, 66, 65, 65, 67, 66, 66, 66, 66, 65, 65, 66, 65, 65, 67, 67, 68, 67, 68, 72, 66, 67, 66, 65, 67, 65, 65, 65, 66, 66, 69, 70, 70, 75, 66, 66, 66, 65, 65, 65, 66, 67, 65, 66, 66, 70, -------------------------------------------------- Any === Number(L) 58, 59, 59, 58, 58, 58, 58, 57, 57, 58, 57, 56, 57, 57, 58, 57, 62, 57, 57, 56, 57, 56, 57, 57, 56, 56, 61, 57, 57, 56, 56, 56, 57, 57, 58, 57, 58, 62, 58, 59, 57, 56, 57, 56, 57, 56, 57, 57, 57, 57, Number(L) === Any 56, 60, 58, 57, 57, 62, 57, 56, 57, 56, 57, 57, 57, 57, 57, 56, 61, 57, 56, 56, 59, 57, 57, 60, 58, 60, 58, 59, 59, 56, 58, 57, 58, 57, 57, 58, 58, 59, 60, 58, 57, 57, 57, 57, 56, 58, 57, 57, 61, 57, -------------------------------------------------- Any === String(L) 61, 61, 60, 60, 61, 61, 60, 61, 63, 61, 60, 60, 60, 61, 61, 61, 61, 66, 60, 60, 60, 61, 61, 60, 60, 60, 60, 60, 60, 60, 62, 66, 60, 60, 60, 61, 60, 61, 60, 59, 60, 59, 60, 60, 60, 60, 61, 61, 60, 61, String(L) === Any 62, 60, 65, 60, 60, 60, 59, 60, 66, 67, 63, 62, 61, 67, 61, 60, 60, 61, 60, 61, 62, 60, 63, 63, 60, 68, 63, 60, 60, 59, 61, 60, 60, 66, 59, 60, 60, 60, 60, 60, 62, 60, 60, 60, 61, 62, 62, 61, 61, 67, -------------------------------------------------- Any === String(S) 61, 60, 65, 60, 60, 59, 60, 60, 59, 59, 61, 61, 60, 65, 61, 59, 59, 60, 60, 59, 60, 61, 65, 59, 60, 59, 61, 59, 59, 59, 61, 61, 60, 59, 60, 60, 60, 60, 61, 60, 59, 59, 60, 59, 60, 59, 60, 59, 59, 60, String(S) === Any 60, 59, 61, 64, 64, 66, 61, 59, 59, 59, 61, 63, 62, 60, 67, 62, 60, 61, 60, 63, 61, 61, 60, 60, 61, 60, 60, 59, 64, 61, 60, 59, 59, 60, 59, 60, 60, 59, 59, 62, 63, 62, 60, 59, 60, 60, 60, 61, 61, 60,
Number == Number(L) 59, 60, 60, 59, 60, 59, 59, 60, 59, 66, 60, 61, 59, 65, 59, 59, 59, 59, 58, 59, 59, 60, 61, 61, 61, 60, 60, 60, 59, 59, 59, 58, 59, 59, 59, 60, 59, 60, 60, 64, 59, 59, 59, 58, 59, 59, 59, 60, 59, 60, Number(L) == Number 59, 61, 59, 60, 60, 59, 65, 59, 59, 59, 62, 63, 63, 67, 61, 60, 59, 60, 59, 59, 59, 59, 58, 59, 59, 59, 59, 60, 60, 64, 59, 60, 60, 59, 60, 60, 64, 60, 58, 59, 60, 64, 59, 59, 59, 60, 59, 60, 59, 59, -------------------------------------------------- Number == String(L) 100, 93, 93, 93, 92, 93, 96, 95, 96, 98, 101, 93, 94, 92, 93, 95, 93, 93, 94, 95, 96, 95, 95, 101, 97, 94, 94, 97, 94, 94, 93, 93, 93, 94, 94, 99, 93, 93, 94, 92, 93, 93, 93, 94, 99, 94, 93, 93, 94, 93, String(L) == Number 92, 93, 93, 93, 93, 99, 92, 92, 92, 92, 94, 96, 95, 101, 92, 94, 97, 94, 99, 98, 93, 93, 92, 92, 92, 93, 94, 94, 98, 94, 94, 99, 94, 93, 96, 94, 96, 97, 99, 96, 93, 94, 92, 92, 92, 92, 94, 93, 93, 98, -------------------------------------------------- String == Number(L) 98, 97, 95, 101, 96, 97, 97, 95, 96, 95, 97, 100, 102, 96, 97, 101, 96, 96, 98, 96, 96, 96, 95, 96, 97, 96, 102, 95, 96, 96, 96, 95, 96, 97, 103, 97, 96, 97, 96, 96, 96, 96, 96, 96, 96, 98, 98, 97, 102, 99, Number(L) == String 97, 101, 96, 95, 96, 95, 97, 96, 96, 96, 99, 99, 99, 98, 99, 99, 99, 98, 98, 97, 96, 98, 96, 101, 95, 95, 97, 97, 96, 96, 96, 95, 95, 95, 94, 97, 95, 100, 95, 95, 97, 96, 96, 101, 95, 96, 95, 95, 94, 95, -------------------------------------------------- String == String(L) 67, 67, 66, 69, 66, 66, 65, 65, 64, 64, 64, 64, 65, 65, 64, 70, 64, 64, 65, 64, 64, 64, 65, 64, 64, 64, 69, 64, 65, 64, 64, 65, 66, 65, 69, 64, 63, 64, 65, 65, 63, 65, 64, 65, 64, 64, 64, 65, 64, 65, String(L) == String 66, 65, 65, 65, 65, 65, 65, 66, 65, 65, 65, 65, 69, 64, 64, 65, 64, 65, 64, 64, 65, 66, 70, 64, 65, 64, 64, 65, 64, 64, 65, 65, 64, 66, 64, 65, 65, 65, 65, 65, 65, 65, 64, 66, 64, 65, 65, 65, 65, 65, -------------------------------------------------- Any == Number(L) 97, 90, 90, 91, 90, 91, 91, 93, 98, 101, 93, 91, 92, 91, 89, 90, 89, 95, 89, 90, 92, 99, 91, 90, 90, 91, 92, 91, 92, 91, 89, 89, 89, 89, 92, 91, 95, 90, 89, 90, 89, 89, 96, 89, 89, 88, 89, 89, 90, 89, Number(L) == Any 98, 92, 98, 100, 95, 94, 94, 94, 94, 94, 96, 90, 89, 89, 89, 89, 90, 89, 90, 91, 90, 90, 90, 95, 90, 89, 89, 88, 88, 89, 89, 88, 88, 88, 89, 90, 90, 93, 89, 89, 91, 92, 91, 90, 91, 92, 90, 91, 91, 89, -------------------------------------------------- Any == String(L) 72, 72, 72, 73, 73, 72, 71, 71, 73, 75, 71, 71, 71, 72, 72, 71, 72, 72, 72, 73, 72, 72, 72, 71, 72, 72, 72, 73, 74, 79, 78, 72, 72, 72, 73, 72, 72, 72, 72, 73, 74, 73, 73, 77, 73, 73, 74, 74, 73, 73, String(L) == Any 72, 72, 71, 71, 72, 73, 72, 77, 72, 72, 73, 73, 73, 72, 72, 72, 72, 73, 74, 73, 78, 73, 75, 80, 75, 74, 78, 76, 75, 72, 71, 72, 72, 71, 72, 72, 71, 72, 72, 73, 73, 72, 73, 72, 72, 77, 73, 71, 72, 72, -------------------------------------------------- Any == String(S) 80, 77, 78, 76, 76, 77, 76, 77, 77, 76, 76, 78, 76, 84, 77, 77, 78, 76, 77, 78, 77, 76, 76, 75, 75, 76, 75, 78, 79, 80, 76, 75, 76, 75, 75, 75, 75, 75, 75, 75, 78, 82, 76, 75, 76, 76, 75, 75, 76, 76, String(S) == Any 83, 77, 77, 76, 76, 75, 75, 75, 76, 76, 75, 75, 75, 78, 75, 75, 76, 77, 77, 75, 78, 78, 76, 78, 78, 78, 76, 80, 79, 82, 76, 76, 77, 77, 77, 77, 76, 77, 78, 78, 77, 77, 77, 76, 78, 75, 76, 75, 75, 77,
ベンチに使ったコード
以下の===を==に変えた物を抽象的等価演算子のベンチに使った。実際にはコメントで括られたコードをそれぞれ別のファイルに書いて実行させて測定した。
function write() { var str = []; for (var i = 0, j = arguments.length; i < j; ++i) str[i] = arguments[i]; document.write(str.join(' ') + '\n'); } var arrN = [], arrS = [], arrA = []; for (var i = 0; i < 50000; ++i) { var t = Math.ceil(Math.random()*6); arrN[i]=t; arrS[i]=""+t; arrA[i]=Math.random()<=0.5?""+t:t; } var it = "==="; //-------------------------------------------------------------------------------------------------- /* (function (arr) { write("Number",it,"Number(L)"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)arr[i]===6; document.write(((new Date)-d) + ', '); } })(arrN.concat()); //*/ /* (function (arr) { write("Number(L)",it,"Number"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)6===arr[i]; document.write(((new Date)-d) + ', '); } })(arrN.concat()); //*/ //-------------------------------------------------------------------------------------------------- /* (function (arr) { write("Number",it,"String(L)"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)arr[i]==="6"; document.write(((new Date)-d) + ', '); } })(arrN.concat()); //*/ /* (function (arr) { write("String(L)",it,"Number"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)"6"===arr[i]; document.write(((new Date)-d) + ', '); } })(arrN.concat()); //*/ //-------------------------------------------------------------------------------------------------- /* (function (arr) { write("String",it,"Number(L)"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)arr[i]===6; document.write(((new Date)-d) + ', '); } })(arrS.concat()); //*/ /* (function (arr) { write("Number(L)",it,"String"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)6===arr[i]; document.write(((new Date)-d) + ', '); } })(arrS.concat()); //*/ //-------------------------------------------------------------------------------------------------- /* (function (arr) { write("String",it,"String(L)"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)arr[i]==="6"; document.write(((new Date)-d) + ', '); } })(arrS.concat()); //*/ /* (function (arr) { write("String(L)",it,"String"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)"6"===arr[i]; document.write(((new Date)-d) + ', '); } })(arrS.concat()); //*/ //-------------------------------------------------------------------------------------------------- /* (function (arr) { write("Any",it,"Number(L)"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)arr[i]===6; document.write(((new Date)-d) + ', '); } })(arrA.concat()); //*/ /* (function (arr) { write("Number(L)",it,"Any"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)6===arr[i]; document.write(((new Date)-d) + ', '); } })(arrA.concat()); //*/ //-------------------------------------------------------------------------------------------------- /* (function (arr) { write("Any",it,"String(L)"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)arr[i]==="6"; document.write(((new Date)-d) + ', '); } })(arrA.concat()); //*/ /* (function (arr) { write("String(L)",it,"Any"); for (var k = 0; k < 10; ++k) { var d=new Date; for(var i=0;i<50000;++i)"6"===arr[i]; document.write(((new Date)-d) + ', '); } })(arrA.concat()); //*/