Bitshift performance vs 64bit numbers #109

Closed
bc99 opened this Issue Nov 13, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@bc99

bc99 commented Nov 13, 2013

Every number is stored with 64bit, except you are doing bit shifting. Then javascript stores the number into a 32bit integer. The result of this: You get negative or just wrong numbers when you are shifting a big js-representing integer.
If you really think bit shift is a good way to improve performance, make sure the numbers are not bigger than 32 bit.

@serbanghita

This comment has been minimized.

Show comment
Hide comment
@serbanghita

serbanghita Nov 14, 2013

@tbcm interesting, maybe you should provide some examples for the guide

@tbcm interesting, maybe you should provide some examples for the guide

@bc99

This comment has been minimized.

Show comment
Hide comment
@bc99

bc99 Nov 14, 2013

I had found a good website about this a few weeks ago, because I ran into this issue. I cannot find it anymore, but here is a stackoverflow link:
http://stackoverflow.com/questions/2373791/bitshift-in-javascript

At the moment I'm very busy, so I cannot create an example. I just thought it would be good to know.

bc99 commented Nov 14, 2013

I had found a good website about this a few weeks ago, because I ran into this issue. I cannot find it anymore, but here is a stackoverflow link:
http://stackoverflow.com/questions/2373791/bitshift-in-javascript

At the moment I'm very busy, so I cannot create an example. I just thought it would be good to know.

@hshoff

This comment has been minimized.

Show comment
Hide comment
@hshoff

hshoff Nov 14, 2013

Member

Ah! Thanks for pointing this out. 🍻

Member

hshoff commented Nov 14, 2013

Ah! Thanks for pointing this out. 🍻

@hshoff hshoff closed this in 8bab767 Nov 14, 2013

@serbanghita

This comment has been minimized.

Show comment
Hide comment
@serbanghita

serbanghita Nov 14, 2013

🍻 thank you!

🍻 thank you!

@supersky07 supersky07 referenced this issue in LuckyBrick/LuckyBrick Dec 14, 2015

Open

[发布]Airbnb JavaScript Style Guide中文版 #5

@mqy1023 mqy1023 referenced this issue in mqy1023/react-with-es6 Aug 29, 2016

Closed

【收藏】Airbnb JavaScript Style Guide #3

@muwenzi muwenzi referenced this issue in muwenzi/Program-Blog Oct 26, 2016

Open

ES2015+语言规范 #38

@kangning1206 kangning1206 referenced this issue in kangning1206/doc Oct 7, 2017

Open

code 规范 #44

@yanlee26 yanlee26 referenced this issue in yanlee26/yanlee26.github.io Feb 2, 2018

Open

JavaScript Style Guide #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment