Skip to content

Commit

Permalink
Forgot to uncomment the non-Hystrix cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Jacobs committed Oct 12, 2016
1 parent 881646c commit da29bfd
Showing 1 changed file with 80 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,86 +236,86 @@ public void tearDown() {
}
}

// @Benchmark
// @BenchmarkMode({Mode.Throughput})
// @OutputTimeUnit(TimeUnit.MILLISECONDS)
// public Integer baselineExecute(BlackholeState bhState) {
// Blackhole.consumeCPU(bhState.blackholeConsumption);
// return 1;
// }
//
// @Benchmark
// @BenchmarkMode({Mode.Throughput})
// @OutputTimeUnit(TimeUnit.MILLISECONDS)
// public Integer baselineQueue(ExecutorState state, final BlackholeState bhState) throws InterruptedException, ExecutionException {
// try {
// return state.executorService.submit(new Callable<Integer>() {
// @Override
// public Integer call() throws Exception {
// Blackhole.consumeCPU(bhState.blackholeConsumption);
// return 1;
// }
// }).get();
// } catch (Throwable t) {
// return 2;
// }
// }
//
// @Benchmark
// @BenchmarkMode({Mode.Throughput})
// @OutputTimeUnit(TimeUnit.MILLISECONDS)
// public Integer baselineSyncObserve(final BlackholeState bhState) throws InterruptedException {
// Observable<Integer> syncObservable = Observable.defer(new Func0<Observable<Integer>>() {
// @Override
// public Observable<Integer> call() {
// Blackhole.consumeCPU(bhState.blackholeConsumption);
// return Observable.just(1);
// }
// });
//
// try {
// return syncObservable.toBlocking().first();
// } catch (Throwable t) {
// return 2;
// }
// }
//
// @Benchmark
// @BenchmarkMode({Mode.Throughput})
// @OutputTimeUnit(TimeUnit.MILLISECONDS)
// public Integer baselineAsyncComputationObserve(final BlackholeState bhState) throws InterruptedException {
// Observable<Integer> asyncObservable = Observable.defer(new Func0<Observable<Integer>>() {
// @Override
// public Observable<Integer> call() {
// Blackhole.consumeCPU(bhState.blackholeConsumption);
// return Observable.just(1);
// }
// }).subscribeOn(Schedulers.computation());
//
// try {
// return asyncObservable.toBlocking().first();
// } catch (Throwable t) {
// return 2;
// }
// }
//
// @Benchmark
// @BenchmarkMode({Mode.Throughput})
// @OutputTimeUnit(TimeUnit.MILLISECONDS)
// public Integer baselineAsyncCustomThreadPoolObserve(ThreadPoolState state, final BlackholeState bhState) {
// Observable<Integer> asyncObservable = Observable.defer(new Func0<Observable<Integer>>() {
// @Override
// public Observable<Integer> call() {
// Blackhole.consumeCPU(bhState.blackholeConsumption);
// return Observable.just(1);
// }
// }).subscribeOn(state.hystrixThreadPool.getScheduler());
// try {
// return asyncObservable.toBlocking().first();
// } catch (Throwable t) {
// return 2;
// }
// }
@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public Integer baselineExecute(BlackholeState bhState) {
Blackhole.consumeCPU(bhState.blackholeConsumption);
return 1;
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public Integer baselineQueue(ExecutorState state, final BlackholeState bhState) throws InterruptedException, ExecutionException {
try {
return state.executorService.submit(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
Blackhole.consumeCPU(bhState.blackholeConsumption);
return 1;
}
}).get();
} catch (Throwable t) {
return 2;
}
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public Integer baselineSyncObserve(final BlackholeState bhState) throws InterruptedException {
Observable<Integer> syncObservable = Observable.defer(new Func0<Observable<Integer>>() {
@Override
public Observable<Integer> call() {
Blackhole.consumeCPU(bhState.blackholeConsumption);
return Observable.just(1);
}
});

try {
return syncObservable.toBlocking().first();
} catch (Throwable t) {
return 2;
}
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public Integer baselineAsyncComputationObserve(final BlackholeState bhState) throws InterruptedException {
Observable<Integer> asyncObservable = Observable.defer(new Func0<Observable<Integer>>() {
@Override
public Observable<Integer> call() {
Blackhole.consumeCPU(bhState.blackholeConsumption);
return Observable.just(1);
}
}).subscribeOn(Schedulers.computation());

try {
return asyncObservable.toBlocking().first();
} catch (Throwable t) {
return 2;
}
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public Integer baselineAsyncCustomThreadPoolObserve(ThreadPoolState state, final BlackholeState bhState) {
Observable<Integer> asyncObservable = Observable.defer(new Func0<Observable<Integer>>() {
@Override
public Observable<Integer> call() {
Blackhole.consumeCPU(bhState.blackholeConsumption);
return Observable.just(1);
}
}).subscribeOn(state.hystrixThreadPool.getScheduler());
try {
return asyncObservable.toBlocking().first();
} catch (Throwable t) {
return 2;
}
}

@Benchmark
@BenchmarkMode({Mode.Throughput})
Expand Down

0 comments on commit da29bfd

Please sign in to comment.