use asByteBuffer() in the CatRank benchmark
This commit is contained in:
parent
9e0bd28c60
commit
6764cc2449
1 changed files with 4 additions and 5 deletions
|
@ -62,15 +62,14 @@ public class CatRank
|
||||||
int urlSize = rng.nextLessThan(100);
|
int urlSize = rng.nextLessThan(100);
|
||||||
|
|
||||||
int urlPrefixLength = URL_PREFIX.size();
|
int urlPrefixLength = URL_PREFIX.size();
|
||||||
StringBuilder url = new StringBuilder();
|
Text.Builder url = result.initUrl(urlSize + urlPrefixLength);
|
||||||
url.append(URL_PREFIX);
|
java.nio.ByteBuffer bytes = url.asByteBuffer();
|
||||||
|
bytes.put(URL_PREFIX.asByteBuffer());
|
||||||
|
|
||||||
for (int j = 0; j < urlSize; j++) {
|
for (int j = 0; j < urlSize; j++) {
|
||||||
url.append('a' + rng.nextLessThan(26));
|
bytes.put((byte) (97 + rng.nextLessThan(26)));
|
||||||
}
|
}
|
||||||
|
|
||||||
result.setUrl(url.toString());
|
|
||||||
|
|
||||||
boolean isCat = rng.nextLessThan(8) == 0;
|
boolean isCat = rng.nextLessThan(8) == 0;
|
||||||
boolean isDog = rng.nextLessThan(8) == 0;
|
boolean isDog = rng.nextLessThan(8) == 0;
|
||||||
if (isCat && !isDog) {
|
if (isCat && !isDog) {
|
||||||
|
|
Loading…
Reference in a new issue