Skip to content

Instantly share code, notes, and snippets.

View shipilev's full-sized avatar

Aleksey Shipilëv shipilev

View GitHub Profile
@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
$ 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)
$ 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
@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:
### 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: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
@shipilev
shipilev / gist:3177965
Created July 25, 2012 19:14
optimized ASR version
/***** BEGIN LICENSE BLOCK *****
* Version: CPL 1.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Common Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.eclipse.org/legal/cpl-v10.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
This is a class:
class C {
final int v;
C(int v) {
this.v = v;
}
int sqr() {
return v*v;
@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
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>