Skip to content

Instantly share code, notes, and snippets.

View shipilev's full-sized avatar

Aleksey Shipilëv shipilev

View GitHub Profile
package org.openjdk;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
/**
* <code>
@BenchmarkMode(Mode.AverageTime)
@Warmup(iterations = 5)
@Measurement(iterations = 5)
@Fork(3)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Benchmark)
public class MyBenchmark {
private static class TestActor extends UntypedActor {
@Override
@shipilev
shipilev / gist:c58caade915c139b1eac
Last active August 29, 2015 14:04
keys.gnupg.net FAIL
$ wget -6 keys.gnupg.net
--2014-07-30 16:27:36-- http://keys.gnupg.net/
Resolving keys.gnupg.net (keys.gnupg.net)... 2001:41d0:8:44d7::1:1, 2001:610:1108:5011::70, 2001:6f8:1c3c:babe::62:1, ...
Connecting to keys.gnupg.net (keys.gnupg.net)|2001:41d0:8:44d7::1:1|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.adeti.org/ [following]
--2014-07-30 16:27:36-- http://www.adeti.org/
Resolving www.adeti.org (www.adeti.org)... 2001:41d0:8:44d7::1:1, 91.121.41.109
$ wget -4 keys.gnupg.net
### Keybase proof
I hereby claim:
* I am shipilev on github.
* I am shipilev (https://keybase.io/shipilev) on keybase.
* I have a public key whose fingerprint is 0190 82BC 00E0 324E 2AEF 4CF0 0D3B 3285 62A1 19A7
To claim this, I am signing this object:
@shipilev
shipilev / gist:cab0bdf8c82ddbf7532f
Last active August 29, 2015 14:02
ThrowingStacklessBench
Benchmark code:
https://github.com/shipilev/article-exception-benchmarks
Prepare:
$ mvn clean install
Run:
$ java -jar target/microbenchmarks.jar ".*ThrowingStackless.*" -f 1 -wi 5 -i 5 -t ${THREADS}
On 2x12x2 Xeon, JDK 8 GA x86_64:
$ acpitool -B
Battery #1 : present
Remaining capacity : 70810 mWh, 98.95%, 06:39:02
Design capacity : 82620 mWh
Last full capacity : 71560 mWh, 86.61% of design capacity
Capacity loss : 13.39%
Present rate : 10647 mW
Charging state : Discharging
Battery type : Li-ion
Model number : 42T4710
$ bin/java -jar ~/projects/jol/jol-cli/target/jol-internals.jar java.lang.String
Running 64-bit HotSpot VM.
Using compressed references with 3-bit shift.
Objects are 8 bytes aligned.
Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
java.lang.String object internals:
OFFSET SIZE TYPE DESCRIPTION VALUE
0 4 (object header) 01 00 00 00 (0000 0001 0000 0000 0000 0000 0000 0000)
@shipilev
shipilev / gist:3f9662a9ea911c30ecbf
Created May 1, 2014 17:49
JMH 0.6.1, SLOC count
SLOC Directory SLOC-by-Language (Sorted)
13427 jmh-core java=12043,xml=1384
10436 jmh-core-it java=10254,xml=182
3088 jmh-core-ct java=2996,xml=92
1691 jmh-samples java=1589,xml=102
1006 jmh-core-benchmarks java=887,xml=119
745 jmh-archetypes xml=738,java=7
671 jmh-generator-bytecode java=567,xml=104
468 jmh-generator-annprocess java=397,xml=71
409 jmh-generator-reflection java=337,xml=72
@shipilev
shipilev / gist:2fddb1d2943a4cbb6080
Created May 1, 2014 17:45
OpenJDK, JDK 8u20, SLOC counts
SLOC Directory SLOC-by-Language (Sorted)
3141572 jdk java=2218158,ansic=413685,xml=390872,cpp=87365,sh=17648,
objc=12653,awk=684,haskell=195,asm=157,cs=72,ruby=44,jsp=24,perl=12,csh=3
789362 hotspot cpp=521039,java=237280,xml=16275,ansic=9670,asm=2774,
sh=2324
273831 langtools java=271273,xml=1472,sh=1086
263726 jaxp java=263509,xml=217
249946 jaxws java=249735,xml=211
103587 corba java=103587
76713 nashorn java=75093,xml=1354,sh=266
@shipilev
shipilev / gist:11340572
Last active August 29, 2015 14:00
P-D 920 internals
$ lspci
00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 81)
00:01.0 PCI bridge: Intel Corporation 82945G/GZ/P/PL PCI Express Root Port (rev 81)
00:1b.0 Audio device: Intel Corporation NM10/ICH7 Family High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 1 (rev 01)
00:1c.2 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 3 (rev 01)
00:1d.0 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #1 (rev 01)
00:1d.1 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #2 (rev 01)
00:1d.2 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #3 (rev 01)
00:1d.3 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #4 (rev 01)