Skip to content

Instantly share code, notes, and snippets.

package chronicle.demo;
import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.wire.BinaryWire;
import net.openhft.chronicle.wire.TextWire;
/**
* Created by daniel on 09/10/2015.
*/
public class WireDeserialiseIntoObjectDemo {
package chronicle.demo;
import net.openhft.chronicle.bytes.IORuntimeException;
import net.openhft.chronicle.wire.Marshallable;
import net.openhft.chronicle.wire.WireIn;
import net.openhft.chronicle.wire.WireOut;
/**
* Created by daniel on 08/10/2015.
*/
package chronicle.demo;
import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.wire.BinaryWire;
import net.openhft.chronicle.wire.TextWire;
/**
* Created by daniel on 09/10/2015.
*/
public class WireDocumentTypeDemo {
package chronicle.demo;
import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.wire.BinaryWire;
import net.openhft.chronicle.wire.TextWire;
/**
* Created by daniel on 09/10/2015.
*/
public class WireDocumentDemo {
package chronicle.demo;
import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.IORuntimeException;
import net.openhft.chronicle.wire.*;
import java.util.function.Function;
public class WireDemo {
public static void main(String[] args) {
package test;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.directory.*;
public class LDAPTest {
public void run() {
@danielshaya
danielshaya / BytesPerfTest.java
Created September 21, 2015 15:34
Comparing Chronicle-Bytes with ByteBuffer
package test;
import net.openhft.chronicle.bytes.Bytes;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
@Test
public void allocationRegressionTest(){
long limit = 1<<20;
ByteWatcher bw = new ByteWatcher();
bw.onByteWatch((t, size) ->
//Allocation breached - cause an assertion to happen
assertTrue(String.format("%s exceeded limit: %d using: %d%n",
t.getName(), limit, size), false)
, limit);
//Run your program here
import org.junit.Test;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class LockVsSync {
private static final boolean COORDINATED_OMISSION = Boolean.getBoolean("coordinatedOmission");
//Either run testing Lock or testing synchronized
private static final boolean IS_LOCK = Boolean.getBoolean("isLock");
private static final int NUM_THREADS = Integer.getInteger("numThreads");
package util;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
@State(Scope.Benchmark)