Ask HN: Performance for converting strings to numbers in JavaScript

2 points by Bahamut ↗ HN
I created this jsperf just now out of curiosity: http://jsperf.com/comparing-various-methods-of-parsing-strings-into-numbe

My findings so far are interesting. The Number constructor in Chrome is a little faster than the other methods of parsing a string into a number, but in Firefox, I am getting that str << 0 is extraordinarily fast in comparison to the others, about 50 times as fast as the next higher.

Does someone here know why this could be?

0 comments

[ 3.0 ms ] story [ 7.0 ms ] thread

No comments yet.