buildscript {
repositories {
jcenter()
maven { url "http://oss.jfrog.org/oss-snapshot-local" }
maven { url "http://clinker.netty.io/nexus/content/repositories/snapshots" }
}
dependencies {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @GrabResolver(name='netty', root='http://clinker.netty.io/nexus/content/repositories/snapshots') | |
| @Grab('io.ratpack:ratpack-groovy:0.9.13-SNAPSHOT') | |
| import ratpack.handling.Handler | |
| import ratpack.server.* | |
| RatpackServer.of { spec -> spec | |
| .config(ServerConfig.noBaseDir()) | |
| .handler { | |
| { ctx -> ctx.render "Hello World!" } as Handler | |
| } |
# ./wrk -t72 -c3000 -d30s http://localhost:5050
Running 30s test @ http://localhost:5050
72 threads and 3000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.82ms 9.03ms 229.22ms 95.25%
Req/Sec 9.58k 3.52k 34.54k 70.33%
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) throws Exception { | |
| EventLoopGroup elg = new NioEventLoopGroup(); | |
| Bootstrap b = new Bootstrap() | |
| .group(elg) | |
| .channel(NioSocketChannel.class) | |
| .option(ChannelOption.SO_KEEPALIVE, true) | |
| .handler(new ChannelInitializer<SocketChannel>() { | |
| @Override | |
| protected void initChannel(SocketChannel ch) throws Exception { | |
| ch.config().setAutoRead(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package app; | |
| import org.springframework.beans.MutablePropertyValues; | |
| import org.springframework.beans.factory.support.BeanDefinitionRegistry; | |
| import org.springframework.beans.factory.support.GenericBeanDefinition; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.http.MediaType; | |
| import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | |
| import org.springframework.http.server.ServletServerHttpResponse; | |
| import org.springframework.web.servlet.ModelAndView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.google.inject.Inject | |
| import com.google.inject.Scopes | |
| import org.reactivestreams.Publisher | |
| import ratpack.exec.ExecController | |
| import ratpack.form.Form | |
| import ratpack.func.Function | |
| import ratpack.groovy.Groovy | |
| import ratpack.guice.Guice | |
| import ratpack.server.RatpackServer | |
| import ratpack.server.ServerConfig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i in $(seq 1 1000); do bash -c "time dig @8.8.8.8 redhat.com>/dev/null &"; done 2>&1 | grep "^real" | grep -v "0m0" |
Does JavaScript optimize for a function that is defined within the context of another function?
For example, are the following examples canonically represented (in performance terms) after compilation, or is one approach favored optimally over the other?
function sortMyThings() {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * The `Promise#map` method is used to retrieve | |
| * a value asynchronously (via a `Promise`) and | |
| * transform it synchronous to a new value. | |
| */ | |
| class MappingSpec extends Specification { | |
| @AutoCleanup | |
| ExecHarness harness = ExecHarness.harness() |