Skip to content

Instantly share code, notes, and snippets.

Ron Pressler pron

Block or report user

Report or block pron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View quasarwhispers.java
package foo;
import co.paralleluniverse.fibers.*;
import co.paralleluniverse.strands.*;
import co.paralleluniverse.strands.channels.*;
import static co.paralleluniverse.strands.channels.Channels.*;
public class quasarwhispers {
static SuspendableRunnable whisper(LongChannel left, LongChannel right) {
return () -> { right.send(left.receive() + 1); }
}
View quasarwhispers.java
package foo;
import co.paralleluniverse.fibers.*;
import co.paralleluniverse.strands.*;
import co.paralleluniverse.strands.channels.*;
import static co.paralleluniverse.strands.channels.Channels.*;
public class quasarwhispers {
static void quasarWhispers(int n) throws Exception {
LongChannel leftmost = newLongChannel(0);
LongChannel left = leftmost, right = leftmost;
View Main.java
package jmodern;
import com.codahale.metrics.*;
import com.codahale.metrics.annotation.*;
import com.fasterxml.jackson.annotation.*;
import com.google.common.base.Optional;
import dagger.Module;
import dagger.ObjectGraph;
import dagger.Provides;
import io.dropwizard.Application;
View Main.java
package jmodern;
import com.codahale.metrics.*;
import com.codahale.metrics.annotation.*;
import com.fasterxml.jackson.annotation.*;
import com.google.common.base.Optional;
import feign.Feign;
import feign.jackson.*;
import feign.jaxrs.*;
import io.dropwizard.Application;
View Main.java
package jmodern;
import com.codahale.metrics.*;
import com.codahale.metrics.annotation.*;
import com.fasterxml.jackson.annotation.*;
import com.google.common.base.Optional;
import feign.Feign;
import feign.jackson.*;
import feign.jaxrs.*;
import io.dropwizard.Application;
View Main.java
package jmodern;
import com.codahale.metrics.*;
import com.codahale.metrics.annotation.*;
import com.fasterxml.jackson.annotation.*;
import com.google.common.base.Optional;
import feign.Feign;
import feign.jackson.*;
import feign.jaxrs.*;
import io.dropwizard.Application;
View gist:dbddbf6da00f346716e6
public class Bench {
public static void main(String[] args) {
double res;
long start;
int numVals = 1000000;
System.out.println("Warming up");
start = System.nanoTime();
res = bar(new double[10000], 5000);
System.out.println("Done. " + ((System.nanoTime() - start) / 1000000) + " ms (" + res + ")");
@pron
pron / gist:6092559
Created Jul 26, 2013
Recursive go blocks with Pulsar
View gist:6092559
(ns co.paralleluniverse.pulsar.examples.walker
(:use [co.paralleluniverse.pulsar.core :exclude [close!]]
[co.paralleluniverse.pulsar.async]))
(defn walk [tree ch]
(letsfn [(walker [t]
(when t
(walker (:left t))
(>! ch (:value t))
(walker (:right t))))]
You can’t perform that action at this time.