Sign in
chromium
/
external
/
github.com
/
WebKit
/
webkit
/
refs/heads/main
/
.
/
JSTests
/
microbenchmarks
/
string-pad-end-indexof.js
blob: f718dc0f4e250861668bddad23d7a876877157f6 [
file
] [
edit
]
// padEnd then indexOf forces full rope resolution + linear scan.
function
bench
()
{
let total
=
0
;
const
base
=
"hello"
;
for
(
let i
=
0
;
i
<
1e6
;
++
i
)
{
const
s
=
base
.
padEnd
(
80
);
total
+=
s
.
indexOf
(
"x"
);
}
return
total
;
}
noInline
(
bench
);
bench
();