MCPcopy Create free account
hub / github.com/apache/fory / RowSuite

Class RowSuite

benchmarks/java/src/main/java/org/apache/fory/benchmark/RowSuite.java:44–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42import org.openjdk.jmh.annotations.Benchmark;
43
44public class RowSuite {
45 private static final Logger LOG = LoggerFactory.getLogger(RowSuite.class);
46
47 public static final class TestStruct implements Serializable {
48 private short f1;
49 private int f2;
50 private long f3;
51 private float f4;
52 private double f5;
53 private double f6;
54 private long f7;
55 private short f11;
56 private int f12;
57 private long f13;
58 private float f14;
59 private double f15;
60 private double f16;
61 private long f17;
62 private List<Integer> intList;
63 }
64
65 public static TestStruct createBeanB(int arrSize) {
66 Random rnd = new Random(37);
67 TestStruct testStruct = new TestStruct();
68 testStruct.f1 = (short) rnd.nextInt();
69 testStruct.f2 = rnd.nextInt();
70 testStruct.f3 = rnd.nextLong();
71 testStruct.f4 = rnd.nextFloat();
72 testStruct.f5 = rnd.nextDouble();
73 testStruct.f6 = rnd.nextDouble();
74 testStruct.f7 = rnd.nextLong();
75 testStruct.f11 = (short) rnd.nextInt();
76 testStruct.f12 = rnd.nextInt();
77 testStruct.f13 = rnd.nextLong();
78 testStruct.f14 = rnd.nextFloat();
79 testStruct.f15 = rnd.nextDouble();
80 testStruct.f16 = rnd.nextDouble();
81 testStruct.f17 = rnd.nextLong();
82 List<Integer> integers = new ArrayList<>();
83 for (int i = 0; i < arrSize; i++) {
84 integers.add(rnd.nextInt());
85 }
86 testStruct.intList = integers;
87 return testStruct;
88 }
89
90 private static TestStruct object = createBeanB(10);
91
92 private static DatumWriter<TestStruct> avroWriter = new ReflectDatumWriter<>(TestStruct.class);
93 private static ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
94 private static BinaryEncoder avroEncoder;
95 private static final byte[] avroData;
96 private static BinaryDecoder avroDecoder =
97 DecoderFactory.get().binaryDecoder(outputStream.toByteArray(), null);
98 private static DatumReader<TestStruct> avroReader = new ReflectDatumReader<>(TestStruct.class);
99
100 private static Encoder<TestStruct> foryEncoder = Encoders.bean(TestStruct.class);
101 private static final byte[] foryData;

Callers

nothing calls this directly

Calls 9

getLoggerMethod · 0.95
createBeanBMethod · 0.95
beanMethod · 0.95
getMethod · 0.65
resetMethod · 0.65
writeMethod · 0.65
encodeMethod · 0.65
toByteArrayMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected