forked from v8/v8
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring-split.js
More file actions
81 lines (64 loc) · 2.15 KB
/
Copy pathstring-split.js
File metadata and controls
81 lines (64 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
new BenchmarkSuite('ShortSubjectEmptySeparator', [5], [
new Benchmark('ShortSubjectEmptySeparator', true, false, 0,
ShortSubjectEmptySeparator),
]);
new BenchmarkSuite('LongSubjectEmptySeparator', [1000], [
new Benchmark('LongSubjectEmptySeparator', true, false, 0,
LongSubjectEmptySeparator),
]);
new BenchmarkSuite('ShortTwoBytesSubjectEmptySeparator', [5], [
new Benchmark('ShortTwoBytesSubjectEmptySeparator', true, false, 0,
ShortTwoBytesSubjectEmptySeparator),
]);
new BenchmarkSuite('LongTwoBytesSubjectEmptySeparator', [1000], [
new Benchmark('LongTwoBytesSubjectEmptySeparator', true, false, 0,
LongTwoBytesSubjectEmptySeparator),
]);
new BenchmarkSuite('ShortSubject', [5], [
new Benchmark('ShortSubject', true, false, 0,
ShortSubject),
]);
new BenchmarkSuite('LongSubject', [1000], [
new Benchmark('LongSubject', true, false, 0,
LongSubject),
]);
new BenchmarkSuite('ShortTwoBytesSubject', [5], [
new Benchmark('ShortTwoBytesSubject', true, false, 0,
ShortTwoBytesSubject),
]);
new BenchmarkSuite('LongTwoBytesSubject', [1000], [
new Benchmark('LongTwoBytesSubject', true, false, 0,
LongTwoBytesSubject),
]);
const shortString = "ababaabcdeaaaaaab";
const shortTwoBytesString = "\u0429\u0428\u0428\u0429\u0429\u0429\u0428\u0429\u0429";
// Use Array.join to create a flat string
const longString = new Array(0x500).fill("abcde").join('');
const longTwoBytesString = new Array(0x500).fill("\u0427\u0428\u0429\u0430").join('');
function ShortSubjectEmptySeparator() {
shortString.split('');
}
function LongSubjectEmptySeparator() {
longString.split('');
}
function ShortTwoBytesSubjectEmptySeparator() {
shortTwoBytesString.split('');
}
function LongTwoBytesSubjectEmptySeparator() {
longTwoBytesString.split('');
}
function ShortSubject() {
shortString.split('a');
}
function LongSubject() {
longString.split('a');
}
function ShortTwoBytesSubject() {
shortTwoBytesString.split('\u0428');
}
function LongTwoBytesSubject() {
longTwoBytesString.split('\u0428');
}