pass-gen

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    function passgen(len, alphabet) {
                var result = '';
   
                if (!alphabet) alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
                var alphabetLength = alphabet.length;
   
                if ((len === undefined) || isNaN(len)) len = 64;
                for (var i = 0; i < len; i++) {
                        var rnd = Math.floor(Math.random() * alphabetLength);
                        result += alphabet[rnd];
                }
   
                return result;
        }
   
    function randomPass() {
        var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'.split('');
        var password = [];
        var passwordLength = 16;
        while (passwordLength--) { password.push( chars[ Math.round( Math.random() * chars.length ) ] ); }
   
        return password.join('');
      };
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
pass-gen
passgen(16)
pending…
rotor
randomPass()
pending…

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

Compare results of other browsers

0 comments

Add a comment