Skip to content

Instantly share code, notes, and snippets.

View andrebrait's full-sized avatar

Andre Brait andrebrait

View GitHub Profile
@andrebrait
andrebrait / find-https-debian-archives.py
Last active May 28, 2017 23:23 — forked from eighthave/find-https-debian-archives.py
Script to find official Debian mirrors that support HTTPS
#!/usr/bin/python
import urllib2
import re
import ssl
import sys
# # find generic mirrors
mirrors = urllib2.urlopen('http://www.debian.org/mirror/list')
https = []
package com.avenuecode.snippet;
import org.openjdk.jmh.annotations.Benchmark;
public class MyBenchmark {
@Benchmark
public void testMethod() {
// This is a demo/sample template for building your JMH benchmarks. Edit as needed.
// Put your benchmark code here.
mvn clean install
java -jar target/benchmarks.jar
package com.avenuecode.snippet;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
experiments, perform baseline and negative tests that provide experimental control, make sure
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
Do not assume the numbers tell you what you want them to tell.
Benchmark (listSize) Mode Cnt Score Error Units
MyBenchmark.atomicLong 1000000 avgt 5 0.026 ± 0.001 s/op
MyBenchmark.atomicLong 10000000 avgt 5 0.263 ± 0.003 s/op
MyBenchmark.atomicLong 100000000 avgt 5 2.504 ± 0.466 s/op
@Benchmark
public void testMethod() {
int a = 1;
int b = 2;
int sum = a + b;
}
@Benchmark
public int testMethod() {
int a = 1;
int b = 2;
int sum = a + b;
return sum;
}
@Benchmark
public void testMethod(Blackhole blackhole) {
int a = 1;
int b = 2;
int sum = a + b;
blackhole.consume(sum);
}
@Benchmark
public int testMethod() {
int sum = 3;
return sum;
}