b9f9aa4499
[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.
29 lines
618 B
Text
Executable file
29 lines
618 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)
|
|
{
|
|
String s = "abcdefgh" + "efghefgh";
|
|
int m = (1024 / s.length()) * 512;
|
|
String g = "";
|
|
int i, l;
|
|
Instant timer = Instant.now();
|
|
|
|
i = 0;
|
|
while (i < (m + 1000))
|
|
{
|
|
i++;
|
|
g += s;
|
|
g = g.replace("efgh", "____");
|
|
l = g.length();
|
|
if (l % (1024 * 64) == 0)
|
|
{
|
|
System.out.println(timer.until(Instant.now(), ChronoUnit.MILLIS) / 1000 + " sec\t\t" + (l / 1024) + "kb");
|
|
}
|
|
}
|
|
}
|
|
}
|