Add benchmark for regexp "gi".
Measure speed regression of a range of char in complex regexp The measurement is using the code from chromium:977003 To measure python -u tools/run_perf.py --binary-override-path out/x64.release/d8 \ test/js-perf-test/RegExp.json Run on three setting: a. m74 based on tag 7.4.301 b. trunk (m77) c. apply cl 1674851 on trunk ComplexCaseInsensitiveTest-RegExp Score is better if higher Score imp % comp to m74 m74 22910 23430 23360 Trunk (m77) 15190 66.30% 15710 67.05% 15570 66.65% CL 1674851 24590 161.88% 107.33% 24690 157.16% 105.38% 24200 155.43% 103.60% Bug: chromium:977003 Change-Id: I7756f4739c44a07949103650565d1ca902e1b7ca Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1679651 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#62449}
This commit is contained in:
parent
e8f8f15f53
commit
b9e1c2c4e9
@ -24,6 +24,7 @@
|
||||
"base_test.js",
|
||||
"base.js",
|
||||
"case_test.js",
|
||||
"complex_case_test.js",
|
||||
"ctor.js",
|
||||
"exec.js",
|
||||
"flags.js",
|
||||
@ -44,6 +45,7 @@
|
||||
"results_regexp": "^%s\\-RegExp\\(Score\\): (.+)$",
|
||||
"tests": [
|
||||
{"name": "CaseInsensitiveTest"},
|
||||
{"name": "ComplexCaseInsensitiveTest"},
|
||||
{"name": "Ctor"},
|
||||
{"name": "Exec"},
|
||||
{"name": "Flags"},
|
||||
|
@ -14,6 +14,7 @@
|
||||
"main": "run.js",
|
||||
"resources": [
|
||||
"case_test.js",
|
||||
"complex_case_test.js",
|
||||
"base_ctor.js",
|
||||
"base_exec.js",
|
||||
"base_flags.js",
|
||||
@ -43,6 +44,7 @@
|
||||
"results_regexp": "^%s\\-RegExp\\(Score\\): (.+)$",
|
||||
"tests": [
|
||||
{"name": "CaseInsensitiveTest"},
|
||||
{"name": "ComplexCaseInsensitiveTest"},
|
||||
{"name": "Ctor"},
|
||||
{"name": "Exec"},
|
||||
{"name": "Flags"},
|
||||
|
46
test/js-perf-test/RegExp/complex_case_test.js
Normal file
46
test/js-perf-test/RegExp/complex_case_test.js
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright 2019 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.
|
||||
|
||||
// The following RegExp regression case from
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=977003
|
||||
let g = "[\\t\\n\\f ]";
|
||||
let W = g + "*";
|
||||
let h = "[\\ud800-\\udbff][\\udc00-\\udfff]";
|
||||
let k = "[\\u0080-\\ud7ff\\ue000-\\ufffd]|" + h;
|
||||
let U = "[0-9a-fA-F]{1,6}" + g + "?";
|
||||
let E = "(?:" + U + "|[\\u0020-\\u007e\\u0080-\\ud7ff\\ue000\\ufffd]|" + h + ")";
|
||||
let m = "\\\\" + E;
|
||||
let o = "(?:[\\t\\x21\\x23-\\x26\\x28-\\x5b\\x5d-\\x7e]|" + k + "|" + m + ")";
|
||||
let p = '[^\'"\\n\\f\\\\]|\\\\[\\s\\S]';
|
||||
let q = '"(?:\'|' + p + ')*"' + '|\'(?:\"|' + p + ')*\'';
|
||||
let r = "[-+]?(?:[0-9]+(?:[.][0-9]+)?|[.][0-9]+)";
|
||||
let t = "(?:[a-zA-Z_]|" + k + "|" + m + ")";
|
||||
let u = "(?:[a-zA-Z0-9_-]|" + k + "|" + m + ")";
|
||||
let v = u + "+";
|
||||
let I = "-?" + t + u + "*";
|
||||
let x = "(?:@?-?" + t + "|#)" + u + "*";
|
||||
let y = r + "(?:%|" + I + ")?";
|
||||
let z = "url[(]" + W + "(?:" + q + "|" + o + "*)" + W + "[)]";
|
||||
let B = "U[+][0-9A-F?]{1,6}(?:-[0-9A-F]{1,6})?";
|
||||
let C = "<\!--";
|
||||
let F = "-->";
|
||||
let S = g + "+";
|
||||
let G = "/(?:[*][^*]*[*]+(?:[^/][^*]*[*]+)*/|/[^\\n\\f]*)";
|
||||
let J = "(?!url[(])" + I + "[(]";
|
||||
let R = "[~|^$*]=";
|
||||
let T = '[^"\'\\\\/]|/(?![/*])';
|
||||
let V = "\\uFEFF";
|
||||
let Y = [V, B, z, J, x, q, y, C, F, S, G, R, T].join("|");
|
||||
|
||||
function ComplexGlobalCaseInsensitiveMatch() {
|
||||
// keep the RegExp in the measurement but not string concat nor join.
|
||||
let X = new RegExp(Y, "gi");
|
||||
"abcſABCβκς".match(X);
|
||||
"color:".match(X);
|
||||
}
|
||||
|
||||
benchmarks = [ [ComplexGlobalCaseInsensitiveMatch, () => {}],
|
||||
];
|
||||
|
||||
createBenchmarkSuite("ComplexCaseInsensitiveTest");
|
@ -9,6 +9,7 @@ load('ctor.js');
|
||||
load('exec.js');
|
||||
load('flags.js');
|
||||
load('inline_test.js')
|
||||
load('complex_case_test.js');
|
||||
load('case_test.js');
|
||||
load('match.js');
|
||||
load('replace.js');
|
||||
|
Loading…
Reference in New Issue
Block a user