flaska/benchmark/regexp_cve.mjs
2024-11-18 03:57:51 +00:00

19 lines
357 B
JavaScript

import { printTime } from './utils.mjs'
var arg = "";
for (var i = 0; i < 1000000; i++) {
arg += "\\";
}
arg += "◎";
let s1 = process.hrtime.bigint()
let s2 = process.hrtime.bigint()
arg = arg.replace(/(?=\\*?)"/g, '$1$1\\"');
arg = arg.replace(/(?=\\*?)$/, '$1$1');
let s3 = process.hrtime.bigint()
let time = s3 - s2 - (s2 - s1)
printTime(time)