IsUpper Speed Comparison (v2)

Revision 2 of this benchmark created by Brent on


Setup

Util = {
    /**
     * @return true if ch is a upper-case letter
     */
    isUpper : function (ch) {
      return ch >=65 && ch <= 90;
    },
  
    isUpper2: function (ch) {
      var ucLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      return ucLetters.indexOf(ch) != -1;
    }  
  }
  var c = "hello".charAt(0)

Test runner

Ready to run.

Testing in
TestOps/sec
Normal isUpper
Util.isUpper(c)
ready
Alternate isUpper2
Util.isUpper2(c)
ready

Revisions

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