gambas-source-code/benchmark/string2.jvs
Benoît Minisini b9f9aa4499 Add java benchmarks.
[BENCHMARK]
* NEW: Add java benchmarks. Note that 'string' and 'string2' benchmarks are too slow when run with the Java interpreter. So they are just run with Java and JIT compilation enabled.
2023-01-10 17:10:31 +01:00

31 lines
483 B
Text
Executable file

#!/usr/bin/java --source 11
import java.time.Instant;
import java.time.temporal.ChronoUnit;
public final class string
{
public static void main(String[] args)
{
StringBuffer sb = new StringBuffer();
String s;
int i;
String c;
int j;
for (i = 1; i <= 1000000; i++)
{
for (j = 65; j <= 90; j++)
{
c = Character.toString(j);
sb.append(".(");
sb.append(c);
sb.append(")");
}
}
s = sb.toString();
System.out.println(s.length());
}
}