public class NullCheckingForGet extends Object
Null checking is on by default. You can disable it by setting either the system property or the environmental variable to "false". The system property is named "arrow.enable_null_check_for_get" and the environmental variable is named "ARROW_ENABLE_NULL_CHECK_FOR_GET". When both the system property and the environmental variable are set, the system property takes precedence.
Disabling null-checking in the "get" methods may lead to performance improvements. For example, suppose we have the following micro-benchmark:
Float8Vector vector = ...
public void test() {
sum = 0;
for (int i = 0; i < 1024; i++) {
vector.set(i, i + 10.0);
safeSum += vector.get(i);
}
}
Performance evaluations of the micro-benchmark with the JMH framework reveal that, disabling null checking has the following effects: 1. The amounts of byte code and assembly code generated by JIT are both smaller. 2. The performance improves by about 30% (2.819 ± 0.005 us/op vs. 4.069 ± 0.004 us/op).
Therefore, for scenarios where the user can be sure that the null-checking is unnecessary, it is beneficial to disable it with this configuration.
Modifier and Type | Field and Description |
---|---|
static boolean |
NULL_CHECKING_ENABLED
The flag to indicate if null checking is enabled for "get" methods.
|
Copyright © 2024 The Apache Software Foundation. All rights reserved.