switchNonIntCases.js 1000 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. /*
  6. ***************PERF TEST********************
  7. * Test for cases with non-integer values.
  8. */
  9. function f(x)
  10. {
  11. switch(x)
  12. {
  13. case f:break;
  14. case f:break;
  15. case f:break;
  16. case f:break;
  17. case f:break;
  18. case f:break;
  19. case f:break;
  20. case f:break;
  21. case f:break;
  22. case f:break;
  23. default:break;
  24. }
  25. }
  26. var _switchStatementStartDate = new Date();
  27. for(i=0;i<300000;i++)
  28. {
  29. f(1)
  30. }
  31. var _switchStatementInterval = new Date() - _switchStatementStartDate;
  32. WScript.Echo("### TIME:", _switchStatementInterval, "ms");