This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-14743-row-formats in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 1316302314a70932734ec8d4fcda2a9a81117a89 Author: Andrew Mashenkov <[email protected]> AuthorDate: Fri Jun 25 18:14:59 2021 +0300 Fix benchmarks --- .../TupleMarshallerVarlenOnlyBenchmark.java | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java index 80f33ac..2d25935 100644 --- a/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java +++ b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java @@ -48,6 +48,7 @@ import org.openjdk.jmh.runner.options.OptionsBuilder; import static org.apache.ignite.internal.schema.NativeTypes.BYTES; import static org.apache.ignite.internal.schema.NativeTypes.LONG; +import static org.apache.ignite.internal.schema.NativeTypes.STRING; /** * Serializer benchmark. @@ -71,18 +72,22 @@ public class TupleMarshallerVarlenOnlyBenchmark { public int fieldsCount; /** Payload size. */ - @Param({"250", "64000", "65000"}) + @Param({"250", "64000", "66000"}) public int dataSize; /** Nullable cols. */ @Param({"true", "false"}) - public boolean nullable; + public boolean nullable ; + + /** Column types. */ + @Param({"string", "bytes"}) + public String type; /** Schema descriptor. */ private SchemaDescriptor schema; - /** Values. */ - private byte[] val; + /** Value. */ + private Object val; /** * Runner. @@ -100,7 +105,8 @@ public class TupleMarshallerVarlenOnlyBenchmark { */ @Setup public void init() { - long seed = System.currentTimeMillis(); + final long seed = System.currentTimeMillis(); + final boolean useString = "string".equals(type); rnd = new Random(seed); @@ -109,7 +115,7 @@ public class TupleMarshallerVarlenOnlyBenchmark { 42, new Column[] {new Column("key", LONG, false)}, IntStream.range(0, fieldsCount).boxed() - .map(i -> new Column("col" + i, BYTES, nullable)) + .map(i -> new Column("col" + i, useString ? STRING : BYTES, nullable)) .toArray(Column[]::new) ); @@ -123,9 +129,19 @@ public class TupleMarshallerVarlenOnlyBenchmark { } }); - val = new byte[dataSize / fieldsCount]; + if (useString) { + final byte[] data = new byte[dataSize / fieldsCount]; + + for (int i = 0; i < data.length; i++) { + final byte b = (byte)rnd.nextInt(); + + data[i] = b < 0 ? (byte)(-b) : b; + } - rnd.nextBytes(val); + val = new String(data); // Latin1 string. + } + else + rnd.nextBytes((byte[])(val = new byte[dataSize / fieldsCount])); } /**
