Double Tilde vs. ParseInt (v24)

Revision 24 of this benchmark created on


Setup

var i = ([1,2,3,4,5,6]).join(''), j,
    superParseInt = function(a) {
            return ~~parseInt(a, 10);
        };

Test runner

Ready to run.

Testing in
TestOps/sec
Double Tilde
j = ~~i;
ready
ParseInt
j = parseInt(i, 10);
j = isNaN(j) ? 0 : j;
ready
Including true
j = i === true ? 1 : ~~parseInt(i, 10);
ready
Slight change to parseInt
j = ~~parseInt(i, 10);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.