proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/event/ExecutionScheduledEvent.java | ExecutionScheduledEvent | toString | class ExecutionScheduledEvent<R> extends ExecutionEvent {
private final R result;
private final Throwable exception;
private final Duration delay;
public ExecutionScheduledEvent(R result, Throwable exception, Duration delay, ExecutionContext<R> context) {
super(context);
this.result = result;
this.... |
return "ExecutionScheduledEvent[" + "result=" + result + ", exception=" + exception + ", delay=" + delay + ']';
| 260 | 37 | 297 | <methods>public int getAttemptCount() ,public java.time.Duration getElapsedAttemptTime() ,public java.time.Duration getElapsedTime() ,public int getExecutionCount() ,public Optional<java.time.Instant> getStartTime() ,public boolean isFirstAttempt() ,public boolean isRetry() <variables>private final non-sealed Execution... |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/BulkheadExecutor.java | BulkheadExecutor | preExecuteAsync | class BulkheadExecutor<R> extends PolicyExecutor<R> {
private final BulkheadImpl<R> bulkhead;
private final Duration maxWaitTime;
public BulkheadExecutor(BulkheadImpl<R> bulkhead, int policyIndex) {
super(bulkhead, policyIndex);
this.bulkhead = bulkhead;
maxWaitTime = bulkhead.getConfig().getMaxWaitT... |
CompletableFuture<ExecutionResult<R>> promise = new CompletableFuture<>();
CompletableFuture<Void> acquireFuture = bulkhead.acquirePermitAsync();
acquireFuture.whenComplete((result, error) -> {
// Signal for execution to proceed
promise.complete(ExecutionResult.none());
});
if (!promis... | 344 | 297 | 641 | <methods>public Function<SyncExecutionInternal<R>,ExecutionResult<R>> apply(Function<SyncExecutionInternal<R>,ExecutionResult<R>>, dev.failsafe.spi.Scheduler) ,public Function<AsyncExecutionInternal<R>,CompletableFuture<ExecutionResult<R>>> applyAsync(Function<AsyncExecutionInternal<R>,CompletableFuture<ExecutionResult... |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/BulkheadImpl.java | BulkheadImpl | tryAcquirePermit | class BulkheadImpl<R> implements Bulkhead<R> {
private static final CompletableFuture<Void> NULL_FUTURE = CompletableFuture.completedFuture(null);
private final BulkheadConfig<R> config;
private final int maxPermits;
// Mutable state
private int permits;
private final FutureLinkedList futures = new FutureL... |
CompletableFuture<Void> future = acquirePermitAsync();
if (future == NULL_FUTURE)
return true;
try {
future.get(maxWaitTime.toNanos(), TimeUnit.NANOSECONDS);
return true;
} catch (CancellationException | ExecutionException | TimeoutException e) {
return false;
}
| 565 | 99 | 664 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/BurstyRateLimiterStats.java | BurstyRateLimiterStats | acquirePermits | class BurstyRateLimiterStats extends RateLimiterStats {
/* The permits per period */
final long periodPermits;
/* The nanos per period */
private final long periodNanos;
/* Available permits. Can be negative during a deficit. */
private long availablePermits;
private long currentPeriod;
BurstyRateLimi... |
long currentNanos = stopwatch.elapsedNanos();
long newCurrentPeriod = currentNanos / periodNanos;
// Update current period and available permits
if (currentPeriod < newCurrentPeriod) {
long elapsedPeriods = newCurrentPeriod - currentPeriod;
long elapsedPermits = elapsedPeriods * periodPerm... | 284 | 375 | 659 | <methods><variables>final non-sealed dev.failsafe.internal.RateLimiterStats.Stopwatch stopwatch |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/CircuitBreakerImpl.java | CircuitBreakerImpl | transitionTo | class CircuitBreakerImpl<R> implements CircuitBreaker<R>, FailurePolicy<R>, DelayablePolicy<R> {
private final CircuitBreakerConfig<R> config;
/** Writes guarded by "this" */
protected final AtomicReference<CircuitState<R>> state = new AtomicReference<>();
public CircuitBreakerImpl(CircuitBreakerConfig<R> con... |
boolean transitioned = false;
State currentState;
synchronized (this) {
currentState = getState();
if (!getState().equals(newState)) {
switch (newState) {
case CLOSED:
state.set(new ClosedState<>(this));
break;
case OPEN:
Duration... | 1,024 | 227 | 1,251 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/ClosedState.java | ClosedState | checkThreshold | class ClosedState<R> extends CircuitState<R> {
public ClosedState(CircuitBreakerImpl<R> breaker) {
super(breaker, CircuitStats.create(breaker, capacityFor(breaker), true, null));
}
@Override
public boolean tryAcquirePermit() {
return true;
}
@Override
public State getState() {
return State.C... |
// Execution threshold can only be set for time based thresholding
if (stats.getExecutionCount() >= config.getFailureExecutionThreshold()) {
// Failure rate threshold can only be set for time based thresholding
double failureRateThreshold = config.getFailureRateThreshold();
if ((failureRateTh... | 320 | 134 | 454 | <methods>public java.time.Duration getRemainingDelay() ,public abstract dev.failsafe.CircuitBreaker.State getState() ,public dev.failsafe.internal.CircuitStats getStats() ,public void handleConfigChange() ,public synchronized void recordFailure(ExecutionContext<R>) ,public synchronized void recordSuccess() <variables>f... |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/CountingCircuitStats.java | CountingCircuitStats | setNext | class CountingCircuitStats implements CircuitStats {
final BitSet bitSet;
private final int size;
/** Index to write next entry to */
volatile int currentIndex;
private volatile int occupiedBits;
private volatile int successes;
private volatile int failures;
public CountingCircuitStats(int size, Circu... |
int previousValue = -1;
if (occupiedBits < size)
occupiedBits++;
else
previousValue = bitSet.get(currentIndex) ? 1 : 0;
bitSet.set(currentIndex, value);
currentIndex = indexAfter(currentIndex);
if (value) {
if (previousValue != 1)
successes++;
if (previousValue... | 879 | 160 | 1,039 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/FallbackExecutor.java | FallbackExecutor | apply | class FallbackExecutor<R> extends PolicyExecutor<R> {
private final FallbackImpl<R> fallback;
private final FallbackConfig<R> config;
private final EventHandler<R> failedAttemptHandler;
public FallbackExecutor(FallbackImpl<R> fallback, int policyIndex) {
super(fallback, policyIndex);
this.fallback = fa... |
return execution -> {
ExecutionResult<R> result = innerFn.apply(execution);
if (execution.isCancelled(this))
return result;
if (isFailure(result)) {
if (failedAttemptHandler != null)
failedAttemptHandler.handle(result, execution);
try {
result = fall... | 842 | 176 | 1,018 | <methods>public Function<SyncExecutionInternal<R>,ExecutionResult<R>> apply(Function<SyncExecutionInternal<R>,ExecutionResult<R>>, dev.failsafe.spi.Scheduler) ,public Function<AsyncExecutionInternal<R>,CompletableFuture<ExecutionResult<R>>> applyAsync(Function<AsyncExecutionInternal<R>,CompletableFuture<ExecutionResult... |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/FallbackImpl.java | FallbackImpl | applyStage | class FallbackImpl<R> implements Fallback<R>, FailurePolicy<R> {
/**
* A fallback that will return null if execution fails.
*/
public static Fallback<Void> NONE = Fallback.<Void>builder(() -> null).build();
private final FallbackConfig<R> config;
public FallbackImpl(FallbackConfig<R> config) {
this.... |
ExecutionAttemptedEvent<R> event = new ExecutionAttemptedEvent<>(result, exception, context);
return config.getFallback() != null ?
CompletableFuture.completedFuture(config.getFallback().apply(event)) :
config.getFallbackStage().apply(event);
| 363 | 82 | 445 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/HalfOpenState.java | HalfOpenState | checkThreshold | class HalfOpenState<R> extends CircuitState<R> {
protected final AtomicInteger permittedExecutions = new AtomicInteger();
public HalfOpenState(CircuitBreakerImpl<R> breaker) {
super(breaker, CircuitStats.create(breaker, capacityFor(breaker), false, null));
permittedExecutions.set(capacityFor(breaker));
}... |
boolean successesExceeded;
boolean failuresExceeded;
int successThreshold = config.getSuccessThreshold();
if (successThreshold != 0) {
int successThresholdingCapacity = config.getSuccessThresholdingCapacity();
successesExceeded = stats.getSuccessCount() >= successThreshold;
failuresE... | 487 | 387 | 874 | <methods>public java.time.Duration getRemainingDelay() ,public abstract dev.failsafe.CircuitBreaker.State getState() ,public dev.failsafe.internal.CircuitStats getStats() ,public void handleConfigChange() ,public synchronized void recordFailure(ExecutionContext<R>) ,public synchronized void recordSuccess() <variables>f... |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/OpenState.java | OpenState | getRemainingDelay | class OpenState<R> extends CircuitState<R> {
private final long startTime = System.nanoTime();
private final long delayNanos;
public OpenState(CircuitBreakerImpl<R> breaker, CircuitState<R> previousState, Duration delay) {
super(breaker, previousState.stats);
this.delayNanos = delay.toNanos();
}
@Ov... |
long elapsedTime = System.nanoTime() - startTime;
long remainingDelay = delayNanos - elapsedTime;
return Duration.ofNanos(Math.max(remainingDelay, 0));
| 222 | 57 | 279 | <methods>public java.time.Duration getRemainingDelay() ,public abstract dev.failsafe.CircuitBreaker.State getState() ,public dev.failsafe.internal.CircuitStats getStats() ,public void handleConfigChange() ,public synchronized void recordFailure(ExecutionContext<R>) ,public synchronized void recordSuccess() <variables>f... |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/RateLimiterExecutor.java | RateLimiterExecutor | preExecuteAsync | class RateLimiterExecutor<R> extends PolicyExecutor<R> {
private final RateLimiterImpl<R> rateLimiter;
private final Duration maxWaitTime;
public RateLimiterExecutor(RateLimiterImpl<R> rateLimiter, int policyIndex) {
super(rateLimiter, policyIndex);
this.rateLimiter = rateLimiter;
maxWaitTime = rateL... |
CompletableFuture<ExecutionResult<R>> promise = new CompletableFuture<>();
long waitNanos = rateLimiter.reservePermits(1, maxWaitTime);
if (waitNanos == -1)
promise.complete(ExecutionResult.exception(new RateLimitExceededException(rateLimiter)));
else {
try {
// Wait for the permit
... | 280 | 259 | 539 | <methods>public Function<SyncExecutionInternal<R>,ExecutionResult<R>> apply(Function<SyncExecutionInternal<R>,ExecutionResult<R>>, dev.failsafe.spi.Scheduler) ,public Function<AsyncExecutionInternal<R>,CompletableFuture<ExecutionResult<R>>> applyAsync(Function<AsyncExecutionInternal<R>,CompletableFuture<ExecutionResult... |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/RateLimiterImpl.java | RateLimiterImpl | tryAcquirePermits | class RateLimiterImpl<R> implements RateLimiter<R> {
private final RateLimiterConfig<R> config;
private final RateLimiterStats stats;
public RateLimiterImpl(RateLimiterConfig<R> config) {
this(config, new Stopwatch());
}
RateLimiterImpl(RateLimiterConfig<R> config, Stopwatch stopwatch) {
this.config... |
long waitNanos = reservePermits(permits, maxWaitTime);
if (waitNanos == -1)
return false;
if (waitNanos > 0)
TimeUnit.NANOSECONDS.sleep(waitNanos);
return true;
| 588 | 74 | 662 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/RetryPolicyImpl.java | RetryPolicyImpl | isAbortable | class RetryPolicyImpl<R> implements RetryPolicy<R>, FailurePolicy<R>, DelayablePolicy<R> {
private final RetryPolicyConfig<R> config;
public RetryPolicyImpl(RetryPolicyConfig<R> config) {
this.config = config;
}
@Override
public RetryPolicyConfig<R> getConfig() {
return config;
}
/**
* Retur... |
for (CheckedBiPredicate<R, Throwable> predicate : config.getAbortConditions()) {
try {
if (predicate.test(result, failure))
return true;
} catch (Throwable ignore) {
}
}
return false;
| 309 | 73 | 382 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/SmoothRateLimiterStats.java | SmoothRateLimiterStats | acquirePermits | class SmoothRateLimiterStats extends RateLimiterStats {
/* The nanos per interval between permits */
final long intervalNanos;
// The amount of time, relative to the start time, that the next permit will be free.
// Will be a multiple of intervalNanos.
private long nextFreePermitNanos;
SmoothRateLimiterSt... |
long currentNanos = stopwatch.elapsedNanos();
long requestedPermitNanos = requestedPermits * intervalNanos;
long waitNanos;
long newNextFreePermitNanos;
// If a permit is currently available
if (currentNanos >= nextFreePermitNanos) {
// Nanos at the start of the current interval
lo... | 245 | 281 | 526 | <methods><variables>final non-sealed dev.failsafe.internal.RateLimiterStats.Stopwatch stopwatch |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/TimedCircuitStats.java | Bucket | indexAfter | class Bucket extends Stat {
long startTimeMillis = -1;
void reset(long startTimeMillis) {
this.startTimeMillis = startTimeMillis;
reset();
}
void copyFrom(Bucket other) {
startTimeMillis = other.startTimeMillis;
successes = other.successes;
failures = other.failures;
... |
return index == buckets.length - 1 ? 0 : index + 1;
| 1,242 | 23 | 1,265 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/TimeoutExecutor.java | TimeoutExecutor | apply | class TimeoutExecutor<R> extends PolicyExecutor<R> {
private final Timeout<R> policy;
private final TimeoutConfig<R> config;
public TimeoutExecutor(TimeoutImpl<R> timeout, int policyIndex) {
super(timeout, policyIndex);
policy = timeout;
config = timeout.getConfig();
}
@Override
public boolean... |
return execution -> {
// Coordinates a result between the timeout and execution threads
AtomicReference<ExecutionResult<R>> result = new AtomicReference<>();
Future<?> timeoutFuture;
try {
// Schedule timeout check
timeoutFuture = Scheduler.DEFAULT.schedule(() -> {
... | 1,144 | 356 | 1,500 | <methods>public Function<SyncExecutionInternal<R>,ExecutionResult<R>> apply(Function<SyncExecutionInternal<R>,ExecutionResult<R>>, dev.failsafe.spi.Scheduler) ,public Function<AsyncExecutionInternal<R>,CompletableFuture<ExecutionResult<R>>> applyAsync(Function<AsyncExecutionInternal<R>,CompletableFuture<ExecutionResult... |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/TimeoutImpl.java | TimeoutImpl | toString | class TimeoutImpl<R> implements Timeout<R> {
private final TimeoutConfig<R> config;
public TimeoutImpl(TimeoutConfig<R> config) {
this.config = config;
}
@Override
public TimeoutConfig<R> getConfig() {
return config;
}
@Override
public PolicyExecutor<R> toExecutor(int policyIndex) {
retur... |
return "Timeout[timeout=" + config.getTimeout() + ", interruptable=" + config.canInterrupt() + ']';
| 145 | 36 | 181 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/util/Assert.java | Assert | notNull | class Assert {
private Assert() {
}
public static void isTrue(boolean expression, String errorMessageFormat, Object... args) {
if (!expression)
throw new IllegalArgumentException(String.format(errorMessageFormat, args));
}
public static <T> T notNull(T reference, String parameterName) {<FILL_FUNCT... |
if (reference == null)
throw new NullPointerException(parameterName + " cannot be null");
return reference;
| 143 | 32 | 175 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/util/DelegatingScheduler.java | ScheduledCompletableFuture | executorService | class ScheduledCompletableFuture<V> extends CompletableFuture<V> implements ScheduledFuture<V> {
// Guarded by this
volatile Future<V> delegate;
// Guarded by this
Thread forkJoinPoolThread;
private final long time;
ScheduledCompletableFuture(long delay, TimeUnit unit) {
this.time = Syste... |
if (executorService != null)
return executorService;
if (FORK_JOIN_POOL == null) {
synchronized (DelegatingScheduler.class) {
if (FORK_JOIN_POOL == null) {
if (ForkJoinPool.getCommonPoolParallelism() > 1)
FORK_JOIN_POOL = ForkJoinPool.commonPool();
else
... | 516 | 148 | 664 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/util/FutureLinkedList.java | Node | pollFirst | class Node {
Node previous;
Node next;
CompletableFuture<Void> future;
}
/**
* Adds a new CompletableFuture to the list and returns it. The returned future will be removed from the list when
* it's completed.
*/
public synchronized CompletableFuture<Void> add() {
Node node = new Node();
... |
Node previousHead = head;
if (head != null) {
head = head.next;
if (head != null)
head.previous = null;
}
return previousHead == null ? null : previousHead.future;
| 239 | 64 | 303 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/util/Lists.java | Lists | of | class Lists {
private Lists() {
}
/**
* Returns a list containing the {@code first} element followed by the {@code rest}.
*/
public static <T> List<T> of(T first, T[] rest) {<FILL_FUNCTION_BODY>}
} |
List<T> result = new ArrayList<>(rest.length + 1);
result.add(first);
Collections.addAll(result, rest);
return result;
| 77 | 46 | 123 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/util/Maths.java | Maths | add | class Maths {
private Maths() {
}
/**
* Returns the sum of {@code a} and {@code b} else {@code Long.MAX_VALUE} if the sum would otherwise overflow.
*/
public static long add(long a, long b) {<FILL_FUNCTION_BODY>}
/**
* Returns the {@code input} rounded down to the nearest {@code interval}.
*/
... |
long naiveSum = a + b;
return (a ^ b) < 0L | (a ^ naiveSum) >= 0L ? naiveSum : 9223372036854775807L + (naiveSum >>> 63 ^ 1L);
| 136 | 77 | 213 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/internal/util/RandomDelay.java | RandomDelay | randomDelay | class RandomDelay {
private RandomDelay() {
}
public static long randomDelayInRange(long delayMin, long delayMax, double random) {
return (long) (random * (delayMax - delayMin)) + delayMin;
}
public static long randomDelay(long delay, long jitter, double random) {
double randomAddend = (1 - random *... |
double randomFactor = 1 + (1 - random * 2) * jitterFactor;
return (long) (delay * randomFactor);
| 152 | 39 | 191 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/spi/ExecutionResult.java | ExecutionResult | withResult | class ExecutionResult<R> {
private static final CompletableFuture<?> NULL_FUTURE = CompletableFuture.completedFuture(null);
private static final ExecutionResult<?> NONE = new ExecutionResult<>(null, null, true, 0, true, true, true);
/** The execution result, if any */
private final R result;
/** The executi... |
boolean unchangedNull = this.result == null && result == null && exception == null;
boolean unchangedNotNull = this.result != null && this.result.equals(result);
return success && (unchangedNull || unchangedNotNull) ?
this :
new ExecutionResult<>(result, null, nonResult, delayNanos, true, true,... | 1,843 | 89 | 1,932 | <no_super_class> |
failsafe-lib_failsafe | failsafe/core/src/main/java/dev/failsafe/spi/FailsafeFuture.java | FailsafeFuture | cancelDependencies | class FailsafeFuture<R> extends CompletableFuture<R> {
private final BiConsumer<ExecutionResult<R>, ExecutionContext<R>> completionHandler;
// Mutable state guarded by "this"
// The most recent execution attempt
private ExecutionInternal<R> newestExecution;
// Functions to apply when this future is cancelle... |
if (cancelFunctions != null) {
int cancellingPolicyIndex =
cancellingPolicyExecutor == null ? Integer.MAX_VALUE : cancellingPolicyExecutor.getPolicyIndex();
Iterator<Entry<Integer, BiConsumer<Boolean, ExecutionResult<R>>>> it = cancelFunctions.entrySet().iterator();
/* This iteration occ... | 1,249 | 238 | 1,487 | <methods>public void <init>() ,public CompletableFuture<java.lang.Void> acceptEither(CompletionStage<? extends R>, Consumer<? super R>) ,public CompletableFuture<java.lang.Void> acceptEitherAsync(CompletionStage<? extends R>, Consumer<? super R>) ,public CompletableFuture<java.lang.Void> acceptEitherAsync(CompletionSta... |
failsafe-lib_failsafe | failsafe/modules/okhttp/src/main/java/dev/failsafe/okhttp/FailsafeCall.java | FailsafeCallBuilder | prepareCall | class FailsafeCallBuilder {
private FailsafeExecutor<Response> failsafe;
private FailsafeCallBuilder(FailsafeExecutor<Response> failsafe) {
this.failsafe = failsafe;
}
public <P extends Policy<Response>> FailsafeCallBuilder compose(P innerPolicy) {
failsafe = failsafe.compose(innerPolicy);... |
okhttp3.Call call;
if (ctx.isFirstAttempt()) {
call = initialCall;
} else {
Response response = ctx.getLastResult();
if (response != null)
response.close();
call = initialCall.clone();
}
// Propagate cancellation to the call
ctx.onCancel(() -> {
cancelled.... | 1,156 | 118 | 1,274 | <no_super_class> |
failsafe-lib_failsafe | failsafe/modules/retrofit/src/main/java/dev/failsafe/retrofit/FailsafeCall.java | FailsafeCallBuilder | executeAsync | class FailsafeCallBuilder<R> {
private FailsafeExecutor<Response<R>> failsafe;
private FailsafeCallBuilder(FailsafeExecutor<Response<R>> failsafe) {
this.failsafe = failsafe;
}
public <P extends Policy<Response<R>>> FailsafeCallBuilder<R> compose(P innerPolicy) {
failsafe = failsafe.compos... |
if (!executed.compareAndSet(false, true)) {
CompletableFuture<Response<R>> result = new CompletableFuture<>();
result.completeExceptionally(new IllegalStateException("already executed"));
return result;
}
failsafeFuture = failsafe.getAsyncExecution(exec -> {
prepareCall(exec).enque... | 882 | 195 | 1,077 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/ASCIICheck.java | ASCIICheck | f1 | class ASCIICheck {
static char[] chars = "http://javaone.com/keynote_large.jpg".toCharArray();
@Benchmark
public void f0_vec(Blackhole bh) {
boolean ascii = true;
{
int i = 0;
while (i + 4 <= chars.length) {
char c0 = chars[i];
char c1... |
boolean ascii = true;
for (int i = 0; i < chars.length; ++i) {
if (chars[i] > 0x007F) {
ascii = false;
break;
}
}
bh.consume(ascii);
| 782 | 80 | 862 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/ASCIICheckTest.java | ASCIICheckTest | f0_perf_test | class ASCIICheckTest {
static final Blackhole BH = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
public void f0_perf() {
ASCIICheck benchmark = new ASCIICheck();
long start = System.currentTimeMillis();
for (int i = 0; i < ... |
for (int i = 0; i < 10; i++) {
f0_perf(); //
}
| 504 | 33 | 537 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/BytesAsciiCheck.java | BytesAsciiCheck | hasNegatives_8 | class BytesAsciiCheck {
static byte[] bytes;
static {
try {
InputStream is = EishayParseBinaryArrayMapping.class.getClassLoader().getResourceAsStream("data/eishay.json");
String str = IOUtils.toString(is, "UTF-8");
bytes = str.getBytes();
} catch (Exception e... |
int i = off;
while (i + 8 <= off + len) {
if ((UNSAFE.getLong(bytes, ARRAY_BYTE_BASE_OFFSET + i) & 0x8080808080808080L) != 0) {
return true;
}
i += 8;
}
for (; i < off + len; i++) {
if (bytes[i] < 0) {
retu... | 540 | 136 | 676 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CSVBank.java | CSVBank | cainiao | class CSVBank {
static final String file = "csv/banklist.csv";
static byte[] byteArray;
static {
try (InputStream is = EishayParseBinary.class.getClassLoader().getResourceAsStream(file)) {
String str = IOUtils.toString(is, "UTF-8");
byteArray = str.getBytes();
} catch... |
// com.cainiao.ai.seq.csv.CsvType.of(Bank.class, false)
// .csvReader(',')
// .read(com.cainiao.ai.seq.InputSource.of(byteArray), 1)
// .supply(BH::consume);
| 557 | 81 | 638 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CSVBankList.java | CSVBankList | readLineValues | class CSVBankList {
static final String file = "csv/banklist.csv";
@Benchmark
public void rowCount(Blackhole bh) throws IOException {
URL resource = Thread.currentThread().getContextClassLoader().getResource(file);
if (resource == null) {
return;
}
File file = n... |
URL resource = Thread.currentThread().getContextClassLoader().getResource(file);
if (resource == null) {
return;
}
File file = new File(resource.getFile());
Type[] types = new Type[] {
String.class, String.class, String.class, Integer.class, String.c... | 328 | 182 | 510 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CSVBig38M.java | CSVBig38M | rowCount | class CSVBig38M {
@Benchmark
public void rowCount(Blackhole bh) throws IOException {<FILL_FUNCTION_BODY>}
@Benchmark
public void readLines(Blackhole bh) throws IOException {
URL resource = Thread.currentThread().getContextClassLoader().getResource("organised_Gen.csv");
if (resource == n... |
URL resource = Thread.currentThread().getContextClassLoader().getResource("organised_Gen.csv");
if (resource == null) {
return;
}
File file = new File(resource.getFile());
FileInputStream fileIn = new FileInputStream(file);
int rowCount = CSVReader.rowCount(... | 407 | 98 | 505 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CSVCDCList.java | CSVCDCList | readLineValues | class CSVCDCList {
static final String file = "csv/CDC_STATE_System_E-Cigarette_Legislation_-_Tax.csv";
@Benchmark
public void rowCount(Blackhole bh) throws IOException {
URL resource = Thread.currentThread().getContextClassLoader().getResource(file);
if (resource == null) {
ret... |
URL resource = Thread.currentThread().getContextClassLoader().getResource(file);
if (resource == null) {
return;
}
File file = new File(resource.getFile());
Type[] types = new Type[] {
Integer.class, // YEAR
Integer.class, // Quator
... | 345 | 383 | 728 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CSVCOVID19.java | Covid19 | main | class Covid19 {
@Parsed(index = 0)
public String providerName;
@Parsed(index = 1)
public String address1;
@Parsed(index = 2)
public String address2;
@Parsed(index = 3)
public String city;
@Parsed(index = 4)
public String county;
... |
Options options = new OptionsBuilder()
.include(CSVCOVID19.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.measurementTime(TimeValue.seconds(30))
... | 330 | 102 | 432 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CSVCOVID19List.java | CSVCOVID19List | readLineValues | class CSVCOVID19List {
static final String file = "csv/COVID-19_Public_Therapeutic_Locator.csv";
@Benchmark
public void rowCount(Blackhole bh) throws IOException {
URL resource = Thread.currentThread().getContextClassLoader().getResource(file);
if (resource == null) {
return;
... |
URL resource = Thread.currentThread().getContextClassLoader().getResource(file);
if (resource == null) {
return;
}
File file = new File(resource.getFile());
Type[] types = new Type[] {
String.class, // Provider Name
String.class, // A... | 343 | 298 | 641 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CSVPerson.java | CSVPerson | cainiao | class CSVPerson {
static final String file = "csv/person.csv";
static byte[] byteArray;
static {
try (InputStream is = EishayParseBinary.class.getClassLoader().getResourceAsStream(file)) {
String str = IOUtils.toString(is, "UTF-8");
byteArray = str.getBytes();
} catch... |
// com.cainiao.ai.seq.csv.CsvType.of(Person.class, false)
// .csvReader(',')
// .read(com.cainiao.ai.seq.InputSource.of(byteArray), 1)
// .supply(BH::consume);
| 571 | 80 | 651 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CSVReaderCOVID19.java | CSVReaderCOVID19 | main | class CSVReaderCOVID19 {
static final String file = "csv/COVID-19_Public_Therapeutic_Locator.csv";
static byte[] byteArray;
static {
try (InputStream is = EishayParseBinary.class.getClassLoader().getResourceAsStream(file)) {
String str = IOUtils.toString(is, "UTF-8");
byteArr... |
Options options = new OptionsBuilder()
.include(CSVReaderCOVID19.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.measurementTime(TimeValue.seconds(30))
... | 318 | 103 | 421 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CartItemDO2Benchmark.java | CartItemDO2Benchmark | newCartsItem | class CartItemDO2Benchmark {
private static volatile List<CartItemDO2> list; // 使用 volatile 修饰确保可见性
private static List<CartItemDO2> newCartsItem() {<FILL_FUNCTION_BODY>}
@Benchmark
public byte[] testCartItem() throws Exception {
return JSONB.toBytes(
newCartsItem(),
... |
if (list != null) {
return list;
}
synchronized (CartItemDO2Benchmark.class) {
if (list == null) {
list = new ArrayList<>();
for (long i = 90000000000L; i < 90000000000L + 1000; i++) {
CartItemDO2 cartItemDO2 = new Car... | 128 | 320 | 448 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/CartTree.java | CartTree | main | class CartTree {
static String str;
static byte[] jsonbBytes;
static ObjectMapper mapper = new ObjectMapper();
public CartTree() {
try {
InputStream is = CartTree.class.getClassLoader().getResourceAsStream("data/cart.json");
str = IOUtils.toString(is, "UTF-8");
... |
Options options = new OptionsBuilder()
.include(CartTree.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.build();
new Runner(options).run();
| 446 | 83 | 529 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/DecodeASCIIBenchmarkJDK8.java | DecodeASCIIBenchmarkJDK8 | main | class DecodeASCIIBenchmarkJDK8 {
static byte[] utf8Bytes = new byte[128];
static int utf8BytesLength;
static long valueFieldOffset;
static {
try {
Field valueField = String.class.getDeclaredField("value");
valueFieldOffset = UNSAFE.objectFieldOffset(valueField);
... |
Options options = new OptionsBuilder()
.include(DecodeASCIIBenchmarkJDK8.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.forks(1)
.build();
new Runner(options).run();
| 392 | 81 | 473 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/DecodeUTF8BenchmarkJDK17.java | DecodeUTF8BenchmarkJDK17 | getLookup | class DecodeUTF8BenchmarkJDK17 {
static byte[] utf8Bytes = "01234567890ABCDEFGHIJKLMNOPQRSTUVWZYZabcdefghijklmnopqrstuvwzyz"
.getBytes(StandardCharsets.UTF_8);
static long valueFieldOffset;
static BiFunction<byte[], Charset, String> stringCreator;
static {
try {
Field va... |
// GraalVM not support
// Android not support
MethodHandles.Lookup lookup;
if (JVM_VERSION >= 17) {
Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, Class.class, int.class);
constructor.setAccessible(t... | 683 | 211 | 894 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/DoubleArray20.java | DoubleArray20 | main | class DoubleArray20 {
static String str;
static ObjectMapper mapper = new ObjectMapper();
static {
try {
InputStream is = EishayParseTreeString.class.getClassLoader().getResourceAsStream("data/double_array_20.json");
str = IOUtils.toString(is, "UTF-8");
} catch (Thro... |
Options options = new OptionsBuilder()
.include(DoubleArray20.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.forks(1)
.warmupIterations(3)
.build();
new Runner(options).run();
| 536 | 85 | 621 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/EncodeUTF8Benchmark.java | EncodeUTF8Benchmark | main | class EncodeUTF8Benchmark {
static String STR = "01234567890ABCDEFGHIJKLMNOPQRSTUVWZYZabcdefghijklmnopqrstuvwzyz一二三四五六七八九十";
static byte[] out;
static long valueFieldOffset;
static {
out = new byte[STR.length() * 3];
try {
Field valueField = String.class.getDeclaredField("v... |
Options options = new OptionsBuilder()
.include(EncodeUTF8Benchmark.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.forks(1)
.build();
new Runner(options).run();
| 346 | 77 | 423 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/HomepageTree.java | HomepageTree | main | class HomepageTree {
static String str;
static byte[] jsonbBytes;
static ObjectMapper mapper = new ObjectMapper();
public HomepageTree() {
try {
InputStream is = HomepageTree.class.getClassLoader().getResourceAsStream("data/homepage.json");
str = IOUtils.toString(is, "UT... |
Options options = new OptionsBuilder()
.include(HomepageTree.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.build();
new Runner(options).run();
| 454 | 84 | 538 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/Issue210.java | Bean | main | class Bean {
private String password;
public Bean() {
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
public static void main(String[] args) throws Runn... |
new Issue210().beanSet();
// Options options = new OptionsBuilder()
// .include(Issue210.class.getName())
// .mode(Mode.Throughput)
// .timeUnit(TimeUnit.MILLISECONDS)
// .forks(1)
// .build();
// new Runner(options).run()... | 93 | 94 | 187 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/Issue609.java | Issue609 | main | class Issue609 {
private static final List<Student> objList;
private static final List<String> strList;
private static final String source;
static {
objList = new ArrayList<>(100000);
strList = new ArrayList<>(100000);
for (int i = 0; i < 100000; i++) {
Student stude... |
Options opt = new OptionsBuilder()
.include(Issue609.class.getName())
.warmupIterations(3)
.measurementIterations(5)
.forks(1)
.jvmArgsAppend("-Xms128m", "-Xmx128m")
.build();
new Runner(opt).run();
| 1,873 | 96 | 1,969 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/JSONReaderNewAndClose.java | JSONReaderNewAndClose | fastjson2 | class JSONReaderNewAndClose {
public static void fastjson2() {<FILL_FUNCTION_BODY>}
public static void fastjson2_0() {
JSONWriter writer = JSONWriter.of();
BH.consume(writer);
writer.close();
}
public static void main(String[] args) throws Exception {
fastjson2_0();
... |
for (int j = 0; j < 5; j++) {
long start = System.currentTimeMillis();
for (int i = 0; i < 100_000_000; ++i) {
fastjson2_0();
}
long millis = System.currentTimeMillis() - start;
System.out.println("fastjson2 millis : " + millis);
... | 107 | 166 | 273 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/LambdaGenerator.java | LambdaGenerator | createSetterInt | class LambdaGenerator {
static final AtomicInteger counter = new AtomicInteger();
public static <T> ObjIntConsumer<T> createSetterInt(Class<T> objectClass, String methodName) throws Throwable {<FILL_FUNCTION_BODY>}
} |
ClassWriter cw = new ClassWriter(null);
final String JAVA_LANG_OBJECT = "java/lang/Object";
String[] interfaces = {"java/util/function/ObjIntConsumer"};
String lambdaClassName = "SetInt$Lambda$" + counter.incrementAndGet();
// if (JDKUtils.JVM_VERSION > 16) {
// Stri... | 70 | 827 | 897 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/LargeFile26MTest.java | LargeFile26MTest | fastjson1_perf | class LargeFile26MTest {
static String str;
static ObjectMapper mapper = new ObjectMapper();
static final int COUNT = 10;
static {
try (
InputStream fis = LargeFile26MTest.class.getClassLoader().getResourceAsStream("data/large-file.json.zip");
BufferedInputStrea... |
long start = System.currentTimeMillis();
for (int i = 0; i < COUNT; ++i) {
com.alibaba.fastjson.JSON.parseObject(str, ArrayList.class);
}
long millis = System.currentTimeMillis() - start;
System.out.println("fastjson1 millis : " + millis);
// zulu17.32.13 :
... | 935 | 139 | 1,074 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/LargeFile2MTest.java | LargeFile2MTest | perfTest | class LargeFile2MTest {
static String str;
static ObjectMapper mapper = new ObjectMapper();
static final int COUNT = 100;
static {
try (
InputStream fis = LargeFile2MTest.class.getClassLoader().getResourceAsStream("data/large-file-2m.json.zip");
BufferedInputStr... |
long start = System.currentTimeMillis();
for (int i = 0; i < COUNT; ++i) {
task.run();
}
long millis = System.currentTimeMillis() - start;
System.out.println("millis : " + millis);
// zulu17.32.13 : 1299 1136
// zulu11.52.13 : 1187 1145
// zul... | 629 | 141 | 770 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/LargeFile3MTest.java | LargeFile3MTest | jackson_perf | class LargeFile3MTest {
static String str;
static ObjectMapper mapper = new ObjectMapper();
static final int COUNT = 100;
static {
try (
InputStream fis = LargeFile3MTest.class.getClassLoader().getResourceAsStream("data/large-file-3m.json.zip");
BufferedInputStr... |
long start = System.currentTimeMillis();
for (int i = 0; i < COUNT; ++i) {
mapper.readValue(str, HashMap.class);
}
long millis = System.currentTimeMillis() - start;
System.out.println("jackson millis : " + millis);
// zulu17.32.13 :
// zulu11.52.13 :
... | 928 | 127 | 1,055 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/Name8.java | Name8 | main | class Name8 {
static String str;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayParseTreeString.class.getClassLoader().getResourceAsStream("data/name8.json");
str = IOUtils.toString(is, "U... |
Options options = new OptionsBuilder()
.include(EishayParseTreeString.class.getName())
.exclude(EishayParseTreeStringPretty.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
... | 392 | 115 | 507 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/SpaceCheckBenchmark.java | SpaceCheckBenchmark | spaceOr | class SpaceCheckBenchmark {
static String str;
static char[] chars;
static final long SPACE = (1L << ' ') | (1L << '\n') | (1L << '\r') | (1L << '\f') | (1L << '\t') | (1L << '\b');
static {
try {
InputStream is = EishayParseStringPretty.class.getClassLoader().getResourceAsStream("... |
int spaceCount = 0;
for (int i = 0; i < chars.length; i++) {
char ch = chars[i];
boolean space = ch == ' '
|| ch == '\n'
|| ch == '\r'
|| ch == '\f'
|| ch == '\t'
|| ch == '\b';
... | 848 | 120 | 968 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/SpaceCheckWorestBenchmark.java | SpaceCheckWorestBenchmark | CharacterIsWhitespace | class SpaceCheckWorestBenchmark {
static char[] chars;
static final long SPACE = (1L << ' ') | (1L << '\n') | (1L << '\r') | (1L << '\f') | (1L << '\t') | (1L << '\b');
static {
chars = new char[1024];
Arrays.fill(chars, '\b');
}
@Benchmark
public void spaceBitAnd(Blackhole bh... |
int spaceCount = 0;
for (int i = 0; i < chars.length; i++) {
char ch = chars[i];
boolean space = Character.isWhitespace(ch);
if (space) {
spaceCount++;
}
}
bh.consume(spaceCount);
| 824 | 85 | 909 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/StringCreateBenchmark.java | StringCreateBenchmark | getStringCreator | class StringCreateBenchmark {
static final BiFunction<char[], Boolean, String> STRING_CREATOR = getStringCreator();
static final char[] chars = new char[128];
static long valueOffset;
static {
try {
Field field = String.class.getDeclaredField("value");
field.setAccessibl... |
try {
MethodHandles.Lookup caller = MethodHandles.lookup().in(String.class);
Field modes = MethodHandles.Lookup.class.getDeclaredField("allowedModes");
modes.setAccessible(true);
modes.setInt(caller, -1); // -1 == Lookup.TRUSTED
// create handle for... | 623 | 238 | 861 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/StringGetValueBenchmark.java | StringGetValueBenchmark | reflect | class StringGetValueBenchmark {
static String STR = "01234567890ABCDEFGHIJKLMNOPQRSTUVWZYZabcdefghijklmnopqrstuvwzyz一二三四五六七八九十";
static final char[] chars = new char[128];
static Field valueField;
static long valueFieldOffset;
static {
try {
valueField = String.class.getDeclare... |
return (char[]) valueField.get(STR);
// for (int i = 0; i < chars.length; i++) {
// char ch = chars[i];
// }
| 520 | 53 | 573 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/TaobaoH5ApiTree.java | TaobaoH5ApiTree | main | class TaobaoH5ApiTree {
static String str;
static ObjectMapper mapper = new ObjectMapper();
public TaobaoH5ApiTree() {
try {
InputStream is = TaobaoH5ApiTree.class.getClassLoader().getResourceAsStream("data/taobao_h5api.json");
str = IOUtils.toString(is, "UTF-8");
} ... |
Options options = new OptionsBuilder()
.include(TaobaoH5ApiTree.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.build();
new Runner(options).run();
... | 366 | 89 | 455 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/along/AlongParseBinaryArrayMapping.java | AlongParseBinaryArrayMapping | main | class AlongParseBinaryArrayMapping {
static Fury fury;
static SkillFire_S2C_Msg object;
static byte[] fastjson2JSONBBytes;
static byte[] furyBytes;
static {
try {
InputStream is = AlongParseBinaryArrayMapping.class.getClassLoader().getResourceAsStream("data/along.json");
... |
Options options = new OptionsBuilder()
.include(AlongParseBinaryArrayMapping.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.buil... | 450 | 96 | 546 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/along/AlongWriteBinaryArrayMapping.java | AlongWriteBinaryArrayMapping | main | class AlongWriteBinaryArrayMapping {
static SkillFire_S2C_Msg object;
static Fury fury;
static {
try {
InputStream is = AlongWriteBinaryArrayMapping.class.getClassLoader().getResourceAsStream("data/along.json");
String str = IOUtils.toString(is, "UTF-8");
object ... |
Options options = new OptionsBuilder()
.include(AlongWriteBinaryArrayMapping.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.buil... | 495 | 96 | 591 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/Eishay.java | Eishay | main | class Eishay {
public static void main(String[] args) throws RunnerException {<FILL_FUNCTION_BODY>}
} |
Options options = new OptionsBuilder()
.include(Eishay.class.getName())
.include(EishayFuryCompatibleParse.class.getName())
.include(EishayFuryCompatibleWrite.class.getName())
.exclude(EishayParseStringNoneCache.class.getName())
.e... | 36 | 218 | 254 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayFury.java | EishayFury | main | class EishayFury {
public static void main(String[] args) throws Exception {<FILL_FUNCTION_BODY>}
} |
Options options = new OptionsBuilder()
.include(EishayFury.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build();
new R... | 36 | 95 | 131 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayFuryCompatibleParse.java | EishayFuryCompatibleParse | main | class EishayFuryCompatibleParse {
static MediaContent mc;
static JSONReader.Feature[] features = {
JSONReader.Feature.SupportAutoType,
JSONReader.Feature.IgnoreNoneSerializable,
JSONReader.Feature.UseDefaultConstructorAsPossible,
JSONReader.Feature.UseNativeObject... |
Options options = new OptionsBuilder()
.include(EishayFuryCompatibleParse.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build()... | 528 | 98 | 626 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayFuryCompatibleWrite.java | EishayFuryCompatibleWrite | main | class EishayFuryCompatibleWrite {
static MediaContent mc;
static JSONWriter.Feature[] features = {
JSONWriter.Feature.WriteClassName,
JSONWriter.Feature.IgnoreNoneSerializable,
JSONWriter.Feature.FieldBased,
JSONWriter.Feature.ReferenceDetection,
JSON... |
Options options = new OptionsBuilder()
.include(EishayFuryCompatibleWrite.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build()... | 533 | 98 | 631 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayFuryParse.java | EishayFuryParse | main | class EishayFuryParse {
static MediaContent mc;
static JSONReader.Feature[] features = {
JSONReader.Feature.SupportAutoType,
JSONReader.Feature.IgnoreNoneSerializable,
JSONReader.Feature.UseDefaultConstructorAsPossible,
JSONReader.Feature.UseNativeObject,
... |
Options options = new OptionsBuilder()
.include(EishayFuryParse.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build();
... | 477 | 96 | 573 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayFuryParseNoneCache.java | EishayFuryParseNoneCache | fastjson2JSONB | class EishayFuryParseNoneCache {
static final int COUNT = 10_000;
static final Class[] classes = new Class[COUNT];
static JSONReader.Feature[] features = {
JSONReader.Feature.SupportAutoType,
JSONReader.Feature.IgnoreNoneSerializable,
JSONReader.Feature.UseDefaultConstru... |
Thread.currentThread().setContextClassLoader(classLoader);
byte[] bytes = fastjson2JSONBBytes[index++];
bh.consume(
JSONB.parseObject(bytes, Object.class, features)
);
| 1,200 | 61 | 1,261 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayFuryWrite.java | EishayFuryWrite | main | class EishayFuryWrite {
static MediaContent object;
static io.fury.ThreadSafeFury fury = io.fury.Fury.builder()
.withLanguage(io.fury.config.Language.JAVA)
.requireClassRegistration(false)
.withRefTracking(true)
.buildThreadSafeFury();
static JSONWriter.Feat... |
Options options = new OptionsBuilder()
.include(EishayFuryWrite.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build();
... | 457 | 96 | 553 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayFuryWriteNoneCache.java | EishayFuryWriteNoneCache | fury | class EishayFuryWriteNoneCache {
static final Class[] classes = new Class[10_000];
static final Object[] objects = new Object[classes.length];
static int index;
static io.fury.ThreadSafeFury fury = io.fury.Fury.builder()
.withLanguage(io.fury.config.Language.JAVA)
.withRefTracki... |
Object object = objects[(index++) % objects.length];
byte[] bytes = fury.serialize(object);
bh.consume(bytes);
| 667 | 42 | 709 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParse.java | EishayParse | main | class EishayParse {
public static void main(String[] args) throws RunnerException {<FILL_FUNCTION_BODY>}
} |
Options options = new OptionsBuilder()
.include(EishayParse.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build();
new ... | 37 | 94 | 131 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseBinary.java | EishayParseBinary | jsonbValid | class EishayParseBinary {
static MediaContent mc;
static byte[] fastjson2UTF8Bytes;
static byte[] fastjson2JSONBBytes;
static byte[] hessianBytes;
static byte[] javaSerializeBytes;
private static final ThreadLocal<Kryo> kryos = new ThreadLocal<Kryo>() {
protected Kryo initialValue() {
... |
JSONReader jsonReader = JSONReader.ofJSONB(fastjson2JSONBBytes);
jsonReader.skipValue();
bh.consume(
jsonReader.isEnd()
);
jsonReader.close();
| 1,147 | 58 | 1,205 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseBinaryArrayMapping.java | EishayParseBinaryArrayMapping | main | class EishayParseBinaryArrayMapping {
static final Fury fury = Fury.builder().withLanguage(Language.JAVA)
.withRefTracking(false)
.requireClassRegistration(false)
.withNumberCompressed(true)
.build();
static MediaContent mediaContent;
static byte[] fastjson2J... |
Options options = new OptionsBuilder()
.include(EishayParseBinaryArrayMapping.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.bui... | 844 | 97 | 941 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseBinaryAutoType.java | EishayParseBinaryAutoType | javaSerialize | class EishayParseBinaryAutoType {
static final SymbolTable symbolTable = JSONB.symbolTable(
"com.alibaba.fastjson2.benchmark.eishay.vo.MediaContent",
"media",
"images",
"height",
"size",
"title",
"uri",
"width",
... |
ByteArrayInputStream bytesIn = new ByteArrayInputStream(javaSerializeBytes);
ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
bh.consume(objectIn.readObject());
| 1,419 | 49 | 1,468 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseString.java | EishayParseString | main | class EishayParseString {
static String str;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static final ObjectReaderProvider provider = new ObjectReaderProvider();
static {
try {
InputStream is = EishayParseString.class.getClassLoade... |
Options options = new OptionsBuilder()
.include(EishayParseString.class.getName())
.exclude(EishayParseStringPretty.class.getName())
.exclude(EishayParseStringNoneCache.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MIL... | 550 | 131 | 681 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseStringNoneCache.java | EishayParseStringNoneCache | fastjson2 | class EishayParseStringNoneCache {
static String str;
// static final ObjectMapper mapper = new ObjectMapper();
// static final Gson gson = new Gson();
static {
try {
InputStream is = EishayParseStringNoneCache.class.getClassLoader().getResourceAsStream("data/eishay_compact.json");
... |
ObjectReaderProvider provider = new ObjectReaderProvider();
JSONReader.Context readContext = JSONFactory.createReadContext(provider);
bh.consume(JSON.parseObject(str, MediaContent.class, readContext));
| 541 | 56 | 597 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseStringPretty.java | EishayParseStringPretty | main | class EishayParseStringPretty {
static String str;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayParseStringPretty.class.getClassLoader().getResourceAsStream("data/eishay.json");
str = IO... |
Options options = new OptionsBuilder()
.include(EishayParseStringPretty.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build();
... | 349 | 97 | 446 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseTreeString.java | EishayParseTreeString | main | class EishayParseTreeString {
static String str;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayParseTreeString.class.getClassLoader().getResourceAsStream("data/eishay_compact.json");
str ... |
Options options = new OptionsBuilder()
.include(EishayParseTreeString.class.getName())
.exclude(EishayParseTreeStringPretty.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
... | 412 | 115 | 527 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseTreeStringPretty.java | EishayParseTreeStringPretty | main | class EishayParseTreeStringPretty {
static String str;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayParseTreeStringPretty.class.getClassLoader().getResourceAsStream("data/eishay.json");
... |
Options options = new OptionsBuilder()
.include(EishayParseTreeStringPretty.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build... | 414 | 98 | 512 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseTreeUTF8Bytes.java | EishayParseTreeUTF8Bytes | main | class EishayParseTreeUTF8Bytes {
static byte[] utf8Bytes;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayParseTreeUTF8Bytes.class.getClassLoader().getResourceAsStream("data/eishay_compact.json");
... |
Options options = new OptionsBuilder()
.include(EishayParseTreeUTF8Bytes.class.getName())
.exclude(EishayParseTreeUTF8BytesPretty.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
... | 390 | 119 | 509 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseTreeUTF8BytesPretty.java | EishayParseTreeUTF8BytesPretty | gson | class EishayParseTreeUTF8BytesPretty {
static byte[] utf8Bytes;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayParseTreeUTF8BytesPretty.class.getClassLoader().getResourceAsStream("data/eishay.json");
... |
bh.consume(gson
.fromJson(
new String(utf8Bytes, 0, utf8Bytes.length, StandardCharsets.UTF_8),
HashMap.class)
);
| 437 | 55 | 492 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseUTF8Bytes.java | EishayParseUTF8Bytes | gson | class EishayParseUTF8Bytes {
static byte[] utf8Bytes;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static final DslJson<Object> dslJson = new DslJson<>(Settings.withRuntime().includeServiceLoader());
static {
try {
InputStream is = E... |
bh.consume(gson
.fromJson(
new String(utf8Bytes, 0, utf8Bytes.length, StandardCharsets.UTF_8),
MediaContent.class)
);
| 547 | 55 | 602 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayParseUTF8BytesPretty.java | EishayParseUTF8BytesPretty | gson | class EishayParseUTF8BytesPretty {
static byte[] utf8Bytes;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayParseUTF8BytesPretty.class.getClassLoader().getResourceAsStream("data/eishay.json");
... |
bh.consume(gson
.fromJson(
new String(utf8Bytes, 0, utf8Bytes.length, StandardCharsets.UTF_8),
HashMap.class)
);
| 445 | 55 | 500 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWrite.java | EishayWrite | main | class EishayWrite {
public static void main(String[] args) throws RunnerException {<FILL_FUNCTION_BODY>}
} |
Options options = new OptionsBuilder()
.include(EishayWrite.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build();
new ... | 37 | 94 | 131 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteBinary.java | EishayWriteBinary | hessian | class EishayWriteBinary {
static MediaContent mc;
static ObjectMapper msgpackMapper = new ObjectMapper(new MessagePackFactory());
static {
try {
InputStream is = EishayWriteBinary.class.getClassLoader().getResourceAsStream("data/eishay.json");
String str = IOUtils.toString(i... |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
Hessian2Output hessian2Output = new Hessian2Output(byteArrayOutputStream);
hessian2Output.writeObject(mc);
hessian2Output.flush();
bh.consume(byteArrayOutputStream.toByteArray());
| 648 | 80 | 728 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteBinaryArrayMapping.java | EishayWriteBinaryArrayMapping | main | class EishayWriteBinaryArrayMapping {
static final Fury fury = Fury.builder().withLanguage(Language.JAVA)
.withRefTracking(false)
.requireClassRegistration(false)
.withNumberCompressed(true)
.build();
static MediaContent mediaContent;
private static final Thr... |
Options options = new OptionsBuilder()
.include(EishayWriteBinaryArrayMapping.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.bui... | 836 | 97 | 933 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteBinaryAutoType.java | EishayWriteBinaryAutoType | javaSerialize | class EishayWriteBinaryAutoType {
static MediaContent mc;
static SymbolTable symbolTable = JSONB.symbolTable(
"com.alibaba.fastjson2.benchmark.eishay.vo.MediaContent",
"media",
"images",
"height",
"size",
"title",
"uri",
... |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(mc);
objectOutputStream.flush();
bh.consume(byteArrayOutputStream.toByteArray());
| 824 | 65 | 889 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteString.java | EishayWriteString | main | class EishayWriteString {
static MediaContent mc;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static ObjectWriterProvider provider = new ObjectWriterProvider();
static {
try {
InputStream is = EishayWriteString.class.getClassLoader... |
Options options = new OptionsBuilder()
.include(EishayWriteString.class.getName())
.exclude(EishayWriteStringNoneCache.class.getName())
.exclude(EishayWriteStringTree.class.getName())
.exclude(EishayWriteStringTree1x.class.getName())
... | 533 | 160 | 693 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteStringNoneCache.java | EishayWriteStringNoneCache | main | class EishayWriteStringNoneCache {
static MediaContent mc;
static {
try {
InputStream is = EishayWriteString.class.getClassLoader().getResourceAsStream("data/eishay.json");
String str = IOUtils.toString(is, "UTF-8");
ObjectReaderProvider provider = new ObjectReaderPr... |
Options options = new OptionsBuilder()
.include(EishayWriteStringNoneCache.class.getName())
.mode(Mode.Throughput)
.warmupIterations(3)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
... | 601 | 108 | 709 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteStringTree.java | EishayWriteStringTree | main | class EishayWriteStringTree {
static JSONObject mc;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayWriteStringTree.class.getClassLoader().getResourceAsStream("data/eishay.json");
String st... |
Options options = new OptionsBuilder()
.include(EishayWriteStringTree.class.getName())
.exclude(EishayWriteStringTree1x.class.getName())
.mode(Mode.Throughput)
.warmupIterations(3)
.timeUnit(TimeUnit.MILLISECONDS)
.... | 509 | 126 | 635 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteStringTree1x.java | EishayWriteStringTree1x | main | class EishayWriteStringTree1x {
static com.alibaba.fastjson.JSONObject mc;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayWriteStringTree1x.class.getClassLoader().getResourceAsStream("data/eishay.json... |
Options options = new OptionsBuilder()
.include(EishayWriteStringTree1x.class.getName())
.mode(Mode.Throughput)
.warmupIterations(3)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.t... | 521 | 109 | 630 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteUTF8Bytes.java | EishayWriteUTF8Bytes | main | class EishayWriteUTF8Bytes {
static MediaContent mc;
static final ObjectMapper mapper = new ObjectMapper();
static final Gson gson = new Gson();
static {
try {
InputStream is = EishayWriteUTF8Bytes.class.getClassLoader().getResourceAsStream("data/eishay.json");
String st... |
Options options = new OptionsBuilder()
.include(EishayWriteUTF8Bytes.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.threads(16)
.build();
... | 372 | 97 | 469 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/EishayWriteUTF8BytesTree.java | EishayWriteUTF8BytesTree | main | class EishayWriteUTF8BytesTree {
static JSONObject mc;
static final ObjectMapper mapper = new ObjectMapper();
static {
try {
InputStream is = EishayWriteUTF8BytesTree.class.getClassLoader().getResourceAsStream("data/eishay.json");
String str = IOUtils.toString(is, "UTF-8");
... |
Options options = new OptionsBuilder()
.include(EishayWriteUTF8BytesTree.class.getName())
.mode(Mode.Throughput)
.warmupIterations(3)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(3)
.forks(1)
.... | 405 | 109 | 514 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/vo/Image.java | Image | equals | class Image
implements java.io.Serializable {
private static final long serialVersionUID = 1L;
public enum Size {
SMALL, LARGE
}
private int height;
private Size size;
private String title; // Can be null
private String uri;
private int width;
public Image() {
... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Image image = (Image) o;
return height == image.height && width == image.width && size == image.size && Objects.equals(title, image.title) && Objects.eq... | 416 | 101 | 517 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/vo/Media.java | Media | equals | class Media
implements java.io.Serializable {
public enum Player {
JAVA, FLASH
}
private int bitrate;
private long duration;
private String format;
private int height;
private List<String> persons;
private Player player;
private long size;
private String title;
... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Media media = (Media) o;
return bitrate == media.bitrate && duration == media.duration && height == media.height && size == media.size && width == media... | 806 | 161 | 967 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/eishay/vo/MediaContent.java | MediaContent | toString | class MediaContent
implements java.io.Serializable {
private Media media;
private List<Image> images;
public MediaContent() {
}
public MediaContent(Media media, List<Image> images) {
this.media = media;
this.images = images;
}
@Override
public boolean equals(Ob... |
StringBuilder sb = new StringBuilder();
sb.append("[MediaContent: ");
sb.append("media=").append(media);
sb.append(", images=").append(images);
sb.append("]");
return sb.toString();
| 405 | 66 | 471 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/AsciiToChars.java | AsciiToChars | toAsciiCharArray | class AsciiToChars {
static final Function<byte[], char[]> TO_CHARS;
static final MethodHandle INFLATE;
static {
Function<byte[], char[]> toChars = null;
MethodHandle inflate = null;
if (JDKUtils.JVM_VERSION > 9) {
try {
Class<?> latin1Class = Class.forNa... |
char[] charArray = new char[bytes.length];
for (int i = 0; i < bytes.length; i++) {
charArray[i] = (char) bytes[i];
}
return charArray;
| 1,090 | 60 | 1,150 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/BigDecimalWrite.java | BigDecimalWrite | init | class BigDecimalWrite {
static final ObjectMapper mapperPlain;
static final ObjectMapper mapper;
static {
mapperPlain = new ObjectMapper();
mapperPlain.configure(SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN, true);
mapper = new ObjectMapper();
}
@Benchmark
public void... |
for (int i = 0; i < strings.length; i++) {
decimals[i] = new BigDecimal(strings[i]);
}
| 1,855 | 43 | 1,898 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DateFormat10.java | DateFormat10 | main | class DateFormat10 {
static final String pattern = "yyyy-MM-dd";
static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
static Date date = new Date(1673323068000L);
static final String str = "2023-01-10";
// @Benchmark
public void javaTimeDateFormatter(Blackhole bh) throws Th... |
Options options = new OptionsBuilder()
.include(DateFormat10.class.getName())
.mode(Mode.Throughput)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(1)
.forks(1)
.build();
new Runner(options).run();
| 499 | 85 | 584 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DateFormat19.java | DateFormat19 | simpleDateFormatThreadLocal | class DateFormat19 {
static final String pattern = "yyyy-MM-dd HH:mm:ss";
static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
static Date date = new Date(1340424794000L);
static FastDateFormat fastDateFormat = FastDateFormat.getInstance(pattern);
static String str = new Simple... |
SimpleDateFormat format = SIMPLE_DATE_FORMAT_LOCAL.get();
String str = format.format(date);
bh.consume(str);
| 849 | 44 | 893 | <no_super_class> |
alibaba_fastjson2 | fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DateParse19.java | DateParse19 | simpleDateFormat | class DateParse19 {
static final String pattern = "yyyy-MM-dd HH:mm:ss";
static String input = "2012-06-23 12:13:14";
static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
static final FastDateFormat FAST_DATE_FORMAT = FastDateFormat.getInstance(pattern);
static ThreadLoc... |
SimpleDateFormat format = new SimpleDateFormat(pattern);
Date date = format.parse(input);
bh.consume(date);
| 796 | 38 | 834 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.