16 lines
356 B
Plaintext
16 lines
356 B
Plaintext
|
|
// AOT-safe microbench: call String.length() many times (heavy)
|
|||
|
|
static box Main {
|
|||
|
|
len1(s) { return s.length() }
|
|||
|
|
main() {
|
|||
|
|
local s = new StringBox("nyash")
|
|||
|
|
local i = 0
|
|||
|
|
local total = 0
|
|||
|
|
// ~160k iterations(重めだが実用時間内)
|
|||
|
|
loop(i < 160000) {
|
|||
|
|
total = total + me.len1(s)
|
|||
|
|
i = i + 1
|
|||
|
|
}
|
|||
|
|
return total
|
|||
|
|
}
|
|||
|
|
}
|