1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

(data1 === data2)と(data1 != data2)の判定は、どちらが速いのか。

Last updated at Posted at 2018-03-06

どちらが速いのか。

let flg = (data1 === data2);
let flg = (data1 != data2);

結果

追加 型が違うと ===は速い。

追加 javaにある hashCodeを実装して文字列チェックすると速いのか。

let fn={};
 fn.hashCode =(s)=>{
    var h=0;for(var i=0;i < s.length; i++) h = h * 31 + s.charCodeAt(i)|0;return h; 
  }
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?