Skip to content

Commit 5f97912

Browse files
committed
move constants
1 parent 44778c0 commit 5f97912

File tree

5 files changed

+34
-10
lines changed

5 files changed

+34
-10
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.arrow.vector;
18+
19+
public class VariableWidthVectorBenchmarkConstants {
20+
public static final String SHORT_VALUE = "InlineValue";
21+
public static final String LONG_VALUE = VariableWidthVectorBenchmarks.class.getName();
22+
}

performance/src/main/java/org/apache/arrow/vector/VariableWidthVectorBenchmarks.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class VariableWidthVectorBenchmarks {
4747

4848
private static final int ALLOCATOR_CAPACITY = 1024 * 1024;
4949

50-
private static byte[] bytes = VariableWidthVectorBenchmarks.class.getName().getBytes();
50+
private static byte[] bytes = VariableWidthVectorBenchmarkConstants.LONG_VALUE.getBytes();
5151
private ArrowBuf arrowBuff;
5252

5353
private BufferAllocator allocator;

performance/src/main/java/org/apache/arrow/vector/VariableWidthVectorInlineValueBenchmarks.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package org.apache.arrow.vector;
1818

19+
import java.util.concurrent.TimeUnit;
1920
import org.apache.arrow.memory.ArrowBuf;
2021
import org.apache.arrow.memory.BufferAllocator;
2122
import org.apache.arrow.memory.RootAllocator;
@@ -35,8 +36,6 @@
3536
import org.openjdk.jmh.runner.options.Options;
3637
import org.openjdk.jmh.runner.options.OptionsBuilder;
3738

38-
import java.util.concurrent.TimeUnit;
39-
4039
/** Benchmarks for {@link BaseVariableWidthVector}. */
4140
@State(Scope.Benchmark)
4241
public class VariableWidthVectorInlineValueBenchmarks {
@@ -48,7 +47,7 @@ public class VariableWidthVectorInlineValueBenchmarks {
4847

4948
private static final int ALLOCATOR_CAPACITY = 1024 * 1024;
5049

51-
private static final byte[] bytes = "InlineValue".getBytes();
50+
private static final byte[] bytes = VariableWidthVectorBenchmarkConstants.SHORT_VALUE.getBytes();
5251
private ArrowBuf arrowBuff;
5352

5453
private BufferAllocator allocator;
@@ -121,7 +120,9 @@ public int setSafeFromNullableVarcharHolder() {
121120
public static void main(String[] args) throws RunnerException {
122121
Options opt =
123122
new OptionsBuilder()
124-
.include(VariableWidthVectorInlineValueBenchmarks.class.getSimpleName() + ".setSafeFromArray")
123+
.include(
124+
VariableWidthVectorInlineValueBenchmarks.class.getSimpleName()
125+
+ ".setSafeFromArray")
125126
.forks(1)
126127
.build();
127128

performance/src/main/java/org/apache/arrow/vector/VariableWidthViewVectorBenchmarks.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class VariableWidthViewVectorBenchmarks {
4747

4848
private static final int ALLOCATOR_CAPACITY = 1024 * 1024;
4949

50-
private static byte[] bytes = VariableWidthVectorBenchmarks.class.getName().getBytes();
50+
private static byte[] bytes = VariableWidthVectorBenchmarkConstants.LONG_VALUE.getBytes();
5151
private ArrowBuf arrowBuff;
5252

5353
private BufferAllocator allocator;

performance/src/main/java/org/apache/arrow/vector/VariableWidthViewVectorInlineValueBenchmarks.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package org.apache.arrow.vector;
1818

19+
import java.util.concurrent.TimeUnit;
1920
import org.apache.arrow.memory.ArrowBuf;
2021
import org.apache.arrow.memory.BufferAllocator;
2122
import org.apache.arrow.memory.RootAllocator;
@@ -35,8 +36,6 @@
3536
import org.openjdk.jmh.runner.options.Options;
3637
import org.openjdk.jmh.runner.options.OptionsBuilder;
3738

38-
import java.util.concurrent.TimeUnit;
39-
4039
/** Benchmarks for {@link BaseVariableWidthVector}. */
4140
@State(Scope.Benchmark)
4241
public class VariableWidthViewVectorInlineValueBenchmarks {
@@ -48,7 +47,7 @@ public class VariableWidthViewVectorInlineValueBenchmarks {
4847

4948
private static final int ALLOCATOR_CAPACITY = 1024 * 1024;
5049

51-
private static byte[] bytes = "InlineValue".getBytes();
50+
private static byte[] bytes = VariableWidthVectorBenchmarkConstants.SHORT_VALUE.getBytes();
5251
private ArrowBuf arrowBuff;
5352

5453
private BufferAllocator allocator;
@@ -121,7 +120,9 @@ public int setSafeFromNullableVarcharHolder() {
121120
public static void main(String[] args) throws RunnerException {
122121
Options opt =
123122
new OptionsBuilder()
124-
.include(VariableWidthViewVectorInlineValueBenchmarks.class.getSimpleName() + ".setSafeFromArray")
123+
.include(
124+
VariableWidthViewVectorInlineValueBenchmarks.class.getSimpleName()
125+
+ ".setSafeFromArray")
125126
.forks(1)
126127
.build();
127128

0 commit comments

Comments
 (0)