Change string building benchmarks.

This commit is contained in:
Stephen Chung 2021-04-23 23:37:44 +08:00
parent dc3a217b2f
commit e58b57b6e7

View File

@ -126,9 +126,9 @@ fn bench_eval_loop_number(bench: &mut Bencher) {
#[bench] #[bench]
fn bench_eval_loop_strings_build(bench: &mut Bencher) { fn bench_eval_loop_strings_build(bench: &mut Bencher) {
let script = r#" let script = r#"
let s = "hello"; let s;
for x in range(0, 10000) { for x in range(0, 10000) {
s += "x"; s = "hello, world!" + "hello, world!";
} }
"#; "#;
@ -143,9 +143,9 @@ fn bench_eval_loop_strings_build(bench: &mut Bencher) {
#[bench] #[bench]
fn bench_eval_loop_strings_no_build(bench: &mut Bencher) { fn bench_eval_loop_strings_no_build(bench: &mut Bencher) {
let script = r#" let script = r#"
let s = "hello"; let s;
for x in range(0, 10000) { for x in range(0, 10000) {
s += ""; s = "hello" + "";
} }
"#; "#;