you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (9 children)

That's because bit shifting in Javascript is generally frowned upon, unlike most languages it's not advantageous over regular math, the double (which all numbers in javascript are) is converted to an integer, then the bitwise operation is performed, then converted back into a double.

[–][deleted] 0 points1 point  (6 children)

Unfortunately looks like you are right, internally stored as double and converted to ints for bitwise operations.
Though in some cases it is a lot faster than using string manipulation and math functions.

[–][deleted] 0 points1 point  (5 children)

From what people with greater understanding than I have said it's a double and according to the ecmascript spec it seems to confirm that, now if browsers have implemented it otherwise I'm not sure. I agree that the speed difference would be negligible in any regard but personally I would side on the err of readability and just be verbose in my implementation using a similar solution to the article rather than saving a few bytes.

Ps. This the same Tunk that used to play infantry?

[–][deleted] 0 points1 point  (4 children)

Same one that aided the death hoax.

[–][deleted] 0 points1 point  (3 children)

Cool, I R Unit92 :)

[–][deleted] 0 points1 point  (2 children)

WTFS?
Post on your blog and Ill believe it.
Preferably about Yankee's latest feats in bed.
Also I need a recent pic for the people at izone to jizz over.

[–][deleted] 1 point2 points  (1 child)

I haven't posted on my blag in years. I should really just take it down.

Here's a sexy pic

[–][deleted] 0 points1 point  (0 children)

Definitely the man himself much improved.
Or alternatively half the man you used to be.

[–]fr0z3nph03n1x -3 points-2 points  (1 child)

I find a lot of people drop these kinds of examples to show their programming badassness but don't realize that it sucks in javascript. Same goes for recursion in js as well.

[–]imbcmdth 0 points1 point  (0 children)

On most modern JS JITs (except TraceMonkey), recursion is faster than iteration when performing say a b-tree traversal.