nashorn/test/examples/string-micro.js
author iignatyev
Wed, 24 May 2017 15:21:14 -0700
changeset 45169 72bd5e8aab2f
parent 24778 2ff5d7041566
permissions -rw-r--r--
8180399: move jdk.testlibrary.LockFreeLogManager to the top level test library Reviewed-by: psandoz, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16192
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
     1
/*
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
24778
2ff5d7041566 8044638: Tidy up Nashorn codebase for code standards
attila
parents: 24720
diff changeset
     3
 *
16192
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
     4
 * Redistribution and use in source and binary forms, with or without
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
     5
 * modification, are permitted provided that the following conditions
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
     6
 * are met:
24778
2ff5d7041566 8044638: Tidy up Nashorn codebase for code standards
attila
parents: 24720
diff changeset
     7
 *
16192
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
     8
 *   - Redistributions of source code must retain the above copyright
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
     9
 *     notice, this list of conditions and the following disclaimer.
24778
2ff5d7041566 8044638: Tidy up Nashorn codebase for code standards
attila
parents: 24720
diff changeset
    10
 *
16192
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    11
 *   - Redistributions in binary form must reproduce the above copyright
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    12
 *     notice, this list of conditions and the following disclaimer in the
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    13
 *     documentation and/or other materials provided with the distribution.
24778
2ff5d7041566 8044638: Tidy up Nashorn codebase for code standards
attila
parents: 24720
diff changeset
    14
 *
16192
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    15
 *   - Neither the name of Oracle nor the names of its
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    16
 *     contributors may be used to endorse or promote products derived
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    17
 *     from this software without specific prior written permission.
24778
2ff5d7041566 8044638: Tidy up Nashorn codebase for code standards
attila
parents: 24720
diff changeset
    18
 *
16192
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    19
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    20
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    21
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    23
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    24
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    25
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    26
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    27
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    28
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    29
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    30
 */
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    31
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    32
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    33
var str = "The quick gray nashorn jumps over the lazy zebra.";
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    34
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    35
function bench(name, func) {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    36
    var start = Date.now();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    37
    for (var iter = 0; iter < 5000000; iter++) {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    38
        func();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    39
    }
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    40
    print((Date.now() - start) + "\t" + name);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    41
}
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    42
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    43
bench("[]", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    44
    str[0];
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    45
    str[1];
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    46
    str[2];
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    47
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    48
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 16192
diff changeset
    49
bench("fromCharCode 1", function() {
16192
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    50
    String.fromCharCode(97);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    51
    String.fromCharCode(98);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    52
    String.fromCharCode(99);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    53
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    54
24720
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 16192
diff changeset
    55
bench("fromCharCode 2", function() {
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 16192
diff changeset
    56
    String.fromCharCode(97, 98);
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 16192
diff changeset
    57
    String.fromCharCode(97, 98, 99);
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 16192
diff changeset
    58
    String.fromCharCode(97, 98, 99, 100);
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 16192
diff changeset
    59
});
75f8388b79df 8035836: Array performance improvements
lagergren
parents: 16192
diff changeset
    60
16192
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    61
bench("charAt 1", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    62
    str.charAt(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    63
    str.charAt(1);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    64
    str.charAt(2);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    65
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    66
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    67
bench("charAt 2", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    68
    str.charAt(100);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    69
    str.charAt(-1);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    70
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    71
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    72
bench("charCodeAt 1", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    73
    str.charCodeAt(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    74
    str.charCodeAt(1);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    75
    str.charCodeAt(2);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    76
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    77
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    78
bench("charCodeAt 2", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    79
    str.charCodeAt(100);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    80
    str.charCodeAt(-1);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    81
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    82
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    83
bench("indexOf 1", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    84
    str.indexOf("T");
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    85
    str.indexOf("h");
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    86
    str.indexOf("e");
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    87
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    88
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    89
bench("indexOf 2", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    90
    str.indexOf("T", 0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    91
    str.indexOf("h", 1);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    92
    str.indexOf("e", 2);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    93
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    94
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    95
bench("lastIndexOf", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    96
    str.indexOf("a");
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    97
    str.indexOf("r");
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    98
    str.indexOf("b");
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
    99
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   100
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   101
bench("slice", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   102
    str.slice(5);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   103
    str.slice(5);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   104
    str.slice(5);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   105
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   106
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   107
bench("split 1", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   108
    str.split();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   109
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   110
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   111
bench("split 2", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   112
    str.split("foo");
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   113
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   114
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   115
bench("split 3", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   116
    str.split(/foo/);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   117
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   118
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   119
bench("substring 1", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   120
    str.substring(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   121
    str.substring(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   122
    str.substring(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   123
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   124
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   125
bench("substring 2", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   126
    str.substring(0, 5);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   127
    str.substring(0, 5);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   128
    str.substring(0, 5);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   129
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   130
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   131
bench("substr", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   132
    str.substr(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   133
    str.substr(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   134
    str.substr(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   135
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   136
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   137
bench("slice", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   138
    str.slice(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   139
    str.slice(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   140
    str.slice(0);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   141
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   142
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   143
bench("concat", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   144
    str.concat(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   145
    str.concat(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   146
    str.concat(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   147
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   148
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   149
bench("trim", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   150
    str.trim();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   151
    str.trim();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   152
    str.trim();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   153
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   154
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   155
bench("toUpperCase", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   156
    str.toUpperCase();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   157
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   158
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   159
bench("toLowerCase", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   160
    str.toLowerCase();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   161
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   162
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   163
bench("valueOf", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   164
    str.valueOf();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   165
    str.valueOf();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   166
    str.valueOf();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   167
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   168
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   169
bench("toString", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   170
    str.toString();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   171
    str.toString();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   172
    str.toString();
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   173
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   174
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   175
bench("String", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   176
    String(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   177
    String(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   178
    String(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   179
});
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   180
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   181
bench("new String", function() {
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   182
    new String(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   183
    new String(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   184
    new String(str);
a2f89e8f0b87 8006408: Clean up and specialize NativeString
hannesw
parents:
diff changeset
   185
});