#include <stdlib.h>
void * jmalloc(size_t size) {
return malloc(size);
}
void jfree(void * ptr) {
free(ptr);
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <x86intrin.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <inttypes.h> | |
static __inline__ uint64_t rdtsc(void){ | |
uint32_t hi, lo; | |
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); | |
return ( (uint64_t)lo)|( ((uint64_t)hi)<<32 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before | |
--------------------------------------------------------------------------------------------------------------------------- | |
Benchmark Time CPU Iterations | |
--------------------------------------------------------------------------------------------------------------------------- | |
BM_HpackEncoderInitDestroy 198 ns 198 ns 3535074 | |
BM_HpackEncoderEncodeDeadline 129 ns 129 ns 5219422 framing_bytes/iter:9 header_bytes/iter:6 | |
BM_HpackEncoderEncodeHeader<EmptyBatch>/0/16384 31 ns 31 ns 22189800 framing_bytes/iter:9 header_bytes/iter:0 | |
BM_HpackEncoderEncodeHeader<EmptyBatch>/1/16384 31 ns 31 ns 22162902 framing_bytes/iter:9 header_bytes/iter:0 | |
BM_HpackEncoderEncodeHeader |
# JMH version: 1.21
# VM version: JDK 13-ea, OpenJDK 64-Bit Server VM, 13-ea+22
# VM invoker: /home/carl/Downloads/jdk-13/bin/java
# VM options: -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:+LogCompilation -XX:LogFile=/tmp/blah.txt -XX:+PrintAssembly -XX:+PrintInterpreter -XX:+PrintNMethods -XX:+PrintNativeNMethods -XX:+PrintSignatureHandlers -XX:+PrintAdapterHandlers -XX:+PrintStubCode -XX:+PrintCompilation -XX:+PrintInlining -XX:+TraceClassLoading -XX:PrintAssemblyOptions=syntax -XX:PrintAssemblyOptions=intel
# Warmup: 10 iterations, 10 s each
# Measurement: 5 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
C2:
# JMH version: 1.21
# VM version: JDK 11.0.2, Java HotSpot(TM) 64-Bit Server VM, 11.0.2+9-LTS
# VM invoker: /home/carl/bin/jdk-11.0.2/bin/java
# VM options: -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+LogCompilation -XX:LogFile=/tmp/blah.txt -XX:+PrintAssembly -XX:+PrintInterpreter -XX:+PrintNMethods -XX:+PrintNativeNMethods -XX:+PrintSignatureHandlers -XX:+PrintAdapterHandlers -XX:+PrintStubCode -XX:+PrintCompilation -XX:+PrintInlining -XX:+TraceClassLoading -XX:PrintAssemblyOptions=syntax -XX:PrintAssemblyOptions=intel
# Warmup: 10 iterations, 1 s each
# Measurement: 5 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.lang.invoke.MethodHandles; | |
import java.lang.invoke.VarHandle; | |
import java.util.concurrent.atomic.AtomicLong; | |
import org.openjdk.jcstress.annotations.Actor; | |
import org.openjdk.jcstress.annotations.Expect; | |
import org.openjdk.jcstress.annotations.JCStressTest; | |
import org.openjdk.jcstress.annotations.Outcome; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DelayedForwardingClientCall<ReqT, RespT> | |
extends ForwardingClientCall<ReqT, RespT>{ | |
private final ClientCall<ReqT, RespT> delegate; | |
private final Queue<Runnable> calls = new ArrayDeque<Runnable>(); | |
private boolean started; | |
protected DelayedForwardingClientCall(ClientCall<ReqT, RespT> delegate) { | |
this.delegate = delegate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl pkcs8 -inform PEM -nocrypt -topk8 -in $INFILE -outform PEM -out $OUTFILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://play.golang.org/p/auAxrJQ1b1 | |
package main | |
import ( | |
"fmt" | |
"reflect" | |
"unsafe" | |
) | |
type rtype struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Benchmark Mode Cnt Score Error Units | |
AtomicBenchmark.compareAndSet sample 1665797 493.817 卤 2.426 ns/op | |
AtomicBenchmark.compareAndSet:compareAndSet路p0.00 sample 25.000 ns/op | |
AtomicBenchmark.compareAndSet:compareAndSet路p0.50 sample 274.000 ns/op | |
AtomicBenchmark.compareAndSet:compareAndSet路p0.90 sample 950.000 ns/op | |
AtomicBenchmark.compareAndSet:compareAndSet路p0.95 sample 1606.000 ns/op | |
AtomicBenchmark.compareAndSet:compareAndSet路p0.99 sample 3760.000 ns/op |