Performance of bitwise operators in javascript

后端 未结 12 2385
难免孤独
难免孤独 2020-12-14 08:33

One of the main ideas behind using bitwise operators in languages like C++/java/C# is that they\'re extremely fast. But I\'ve heard that in javascript they\'re very slow (ad

12条回答
  •  不思量自难忘°
    2020-12-14 09:19

    When speed is paramount, you can use them for bit-masking: http://snook.ca/archives/javascript/storing_values/

    Also, if you need to support Netscape 4, you'd use them to deal with Document.captureEvents(). Not that any respectable company would have you write JS for NS4...

提交回复
热议问题