Skip to content

Instantly share code, notes, and snippets.

View m0wfo's full-sized avatar

Chris Mowforth m0wfo

  • Planet Earth
View GitHub Profile
@m0wfo
m0wfo / volatile_gen.asm
Last active March 23, 2016 21:56
HotSpot-generated assembly for a volatile read
0x000000010d6895e3: jmpq 0x000000010d68963c ;*iload_3
; - com.logentries.blog.VolatileClass::run@2 (line 13)
0x000000010d6895e8: vmovsd 0x10(%rsi),%xmm0 ; implicit exception: dispatches to 0x000000010d6897ce
0x000000010d6895ed: vmovq %xmm0,%rdx ;*getfield a
; - com.logentries.blog.VolatileClass::run@12 (line 14)
0x000000010d6895f2: inc %edi
@m0wfo
m0wfo / volatile.java
Created March 23, 2016 21:16
VolatileExample
public class VolatileClass implements Runnable {
public volatile long a;
@Override
public void run() {
long b;
for (int i = 0; i < 1E9; i++) {
b = a;
}
@m0wfo
m0wfo / nonvolatile.java
Last active March 23, 2016 21:17
Nonvolatile example
public class NonVolatileClass implements Runnable {
public long a;
@Override
public void run() {
long b;
for (int i = 0; i < 1E9; i++) {
b = a;
}
@m0wfo
m0wfo / nonvolatile_gen.asm
Last active March 23, 2016 21:17
HotSpot-generated assembly for a nonvolatile read
0x0000000104287223: jmpq 0x0000000104287276 ;*iload_3
; - com.logentries.blog.NonVolatileClass::run@2 (line 13)
0x0000000104287228: mov 0x10(%rsi),%rdx ;*getfield a
; - com.logentries.blog.NonVolatileClass::run@12 (line 14)
; implicit exception: dispatches to 0x00000001042873fe
0x000000010428722c: inc %edi
# Run complete. Total time: 00:01:11
Benchmark Mode Cnt Score Error Units
JMHBenchmark.padded thrpt 25 728583552.130 ± 4268366.821 ops/s
JMHBenchmark.padded:updatePaddedA thrpt 25 363537357.980 ± 2313491.132 ops/s
JMHBenchmark.padded:updatePaddedB thrpt 25 365046194.150 ± 2045685.311 ops/s
JMHBenchmark.unpadded thrpt 25 148478851.964 ± 2746611.843 ops/s
JMHBenchmark.unpadded:updateUnpaddedA thrpt 25 74249061.512 ± 1926331.358 ops/s
JMHBenchmark.unpadded:updateUnpaddedB thrpt 25 74229790.452 ± 1126025.534 ops/s
@JsonIgnoreProperties(ignoreUnknown = true)
public class {
public Integer getValue();
public UUID getTransactionId();
}
///
/// Parse + Logentries integration- based on this gist: https://gist.github.com/rogernolan/95ea615164e343b3bc54
/// proof-of-concept; might have the odd typo
///
var DEBUG = false;
var logger = (function(){
// Rely on Parse.com using node module caching to not duplicate this stuff.
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS)
public static class Wrapper {
}
@Test
public void testPolymorphicTypeIsReturnedWithoutMap() throws Exception {
Wrapper alertNotifyTag = new Wrapper();
String serialized = mapper.writeValueAsString(alertNotifyTag);
List<Iterator<Event>> iterators = FluentIterable.from(source_keys)
.transform(source_key -> getIterator(tail_query, source_key))
.filter(Predicates.notNull())
.toList()
// Request
OPTIONS /v1/logs/logid HTTP/1.1
Host: js.logentries.com
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: https://logentries.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
Access-Control-Request-Headers: x-requested-with, content-type
Accept: */*