de200aac4c
[BENCHMARKS] * NEW: Add a new 'btree' benchmark, that does a lot of object creation and recursive function calls. * NEW: Rename the 'string' benchmark as 'string1', to avoid name clashes in Python. * BUG: Fix the HTML table generation.
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");
|
|
}
|
|
}
|
|
}
|
|
}
|