Java Code Examples for org.openjdk.jmh.annotations.Mode#Throughput

The following examples show how to use org.openjdk.jmh.annotations.Mode#Throughput . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadLocalBenchmark.java    From turbo-rpc with Apache License 2.0 6 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public Integer threadMap() {
	Thread key = Thread.currentThread();
	Integer value = threadMap.get(key);

	if (value != null) {
		return value;
	}

	value = 100;
	threadMap.put(key, value);

	return value;
}
 
Example 2
Source File: ManualBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void serializeUserList() throws Exception {
	listBuffer.clear();
	userPageSerializer.write(listBuffer, userPage);
}
 
Example 3
Source File: ProtostuffBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void serializeUserList() throws Exception {
	listBuffer.clear();
	ByteBufOutput output = new ByteBufOutput(listBuffer);
	userPageSchema.writeTo(output, userPage);
}
 
Example 4
Source File: DefaultBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void nettyByteBufPage() {
	nettyByteBuf.clear();
	nettyByteBufOutput.setBuffer(nettyByteBuf);
	kryo.writeObject(nettyByteBufOutput, page);

	nettyByteBufInput.setBuffer(nettyByteBuf);
	kryo.readObject(nettyByteBufInput, Page.class);
}
 
Example 5
Source File: JacksonBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void serializeUserList() throws Exception {
	listBuffer.clear();
	jacksonMapper.write(listBuffer, userPage);
}
 
Example 6
Source File: OpenAddressBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void putNettyMap() {
	for (int i = 0; i < 1024 * 64; i++) {
		nettyMap.put(i, Integer.valueOf(i));
	}
}
 
Example 7
Source File: ClientPb.java    From dubbo-benchmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime})
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public PagePB.User getUser() throws Exception {
    final int count = counter.getAndIncrement();
    return userService.getUser(PagePB.Request.newBuilder().setId(count).build()).getUser();
}
 
Example 8
Source File: OpenAddressBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void getHashMap() {
	for (int i = 0; i < 1024 * 64; i++) {
		hashMap.get(i);
	}
}
 
Example 9
Source File: ConcurrentArrayListBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void newAndPutWithArrayList() {
	ArrayList<Boolean> arrayList = new ArrayList<>();

	for (int i = 0; i < 1024; i++) {
		arrayList.add(Boolean.TRUE);
	}
}
 
Example 10
Source File: Client.java    From rpc-benchmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput, Mode.AverageTime, Mode.SampleTime })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Override
public User getUser() throws Exception {
	return super.getUser();
}
 
Example 11
Source File: Client.java    From rpc-benchmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput, Mode.AverageTime, Mode.SampleTime })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Override
public User getUser() throws Exception {
	return super.getUser();
}
 
Example 12
Source File: KryoBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void serializeUserList() throws Exception {
	listBuffer.clear();
	output.setBuffer(listBuffer);
	kryo.writeClassAndObject(output, userPage);
}
 
Example 13
Source File: DefaultBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void fastUser() {
	fastOutput.clear();
	kryo.writeObject(fastOutput, user);

	fastInput.setBuffer(bytes, 0, (int) fastOutput.total());
	kryo.readObject(fastInput, User.class);
}
 
Example 14
Source File: Client.java    From rpc-benchmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput, Mode.AverageTime, Mode.SampleTime })
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public Page<MotanUser> listUser() throws Exception {
	int pageNo = counter.getAndIncrement();
	return userService.listUser(pageNo);
}
 
Example 15
Source File: AtomicIntergerArrayBenchmark.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void atomicMuiltInteger2() {
	int index = ThreadLocalRandom.current().nextInt(length);
	int value = atomicMuiltInteger2.get(index);
	atomicMuiltInteger2.set(index, value + 1);
}
 
Example 16
Source File: StringTest.java    From turbo-rpc with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public byte[] StringUtils2_getUTF8Bytes() throws Exception {
	return UnsafeStringUtils.getUTF8Bytes(str);
}
 
Example 17
Source File: UUIDBenchmark.java    From turbo-rpc with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public String newRandomId128HexString() throws Exception {
	return RandomId128.next().toHexString();
}
 
Example 18
Source File: ByteBufUtilsBenchmark.java    From turbo-rpc with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void byteBufSetInt() {
	buffer.setInt(0, 1);
}
 
Example 19
Source File: UUIDBenchmark.java    From turbo-rpc with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode({ Mode.Throughput })
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public ObjectId128 newObjectId128() throws Exception {
	return ObjectId128.next();
}
 
Example 20
Source File: MessageComparatorBenchmark.java    From sailfish-core with Apache License 2.0 4 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void benchmarkSimpleFilterMessage(FilterState state, Blackhole blackhole) {
    blackhole.consume(benchmark(state, blackhole));
}