use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class ReactToList method parallel.
@Test
public void parallel() {
List<Integer> values = new ArrayList();
for (int i = 0; i < 4000; i++) values.add(i);
LazyReact lazy = LazyReact.parallelBuilder(8).autoOptimizeOn().withMaxActive(MaxActive.CPU);
SimpleTimer t = new SimpleTimer();
for (int x = 0; x < 1000; x++) {
res = lazy.from(values).map(i -> i + 2).map(i -> i * 3).collect(Collectors.toList());
}
System.out.println(t.getElapsedNanoseconds());
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class BatchingTest method judder.
@Test
public void judder() {
SimpleTimer timer = new SimpleTimer();
assertThat(of(1, 2, 3, 4, 5, 6).jitter(10000).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(20000l));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class BatchingTest method onePer.
@Test
public void onePer() {
SimpleTimer timer = new SimpleTimer();
System.out.println(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).collect(Collectors.toList()));
assertThat(of(1, 2, 3, 4, 5, 6).onePer(1000, TimeUnit.NANOSECONDS).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(600l));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class BatchingTest method debounce.
@Test
public void debounce() {
SimpleTimer timer = new SimpleTimer();
assertThat(of(1, 2, 3, 4, 5, 6).debounce(1000, TimeUnit.SECONDS).collect(Collectors.toList()).size(), is(1));
}
use of com.oath.cyclops.util.SimpleTimer in project cyclops by aol.
the class BatchingTest method fixedDelay.
@Test
public void fixedDelay() {
SimpleTimer timer = new SimpleTimer();
assertThat(of(1, 2, 3, 4, 5, 6).fixedDelay(10000, TimeUnit.NANOSECONDS).collect(Collectors.toList()).size(), is(6));
assertThat(timer.getElapsedNanoseconds(), greaterThan(60000l));
}
Aggregations