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 problem of associating tasks to channels could be solved by | |
| // having the developer tell us, which channel a task belongs to | |
| // this would make filtering the tasks on migration very easy. | |
| // The downside is that it is subject to user errors. | |
| // | |
| // null if it doesn't belong to any particular channel | |
| execute(ch, new Runnable() { | |
| @Override | |
| public void run() { | |
| ch.flush(); |
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
| /* | |
| * Copyright 2014 The Netty Project | |
| * | |
| * The Netty Project licenses this file to you under the Apache License, | |
| * version 2.0 (the "License"); you may not use this file except in compliance | |
| * with the License. You may obtain a copy of the License at: | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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 java.util.concurrent.Executor; | |
| import java.util.concurrent.ForkJoinTask; | |
| import java.util.concurrent.RunnableFuture; | |
| public class EventLoop implements Runnable { | |
| final Executor executor; | |
| final AdaptedRunnable pool[] = new AdaptedRunnable[2]; | |
| volatile int cnt; | |
| EventLoop(Executor executor) { |
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
| diff --git a/codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java b/codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java | |
| index c5a165c..8f7e29c 100644 | |
| --- a/codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java | |
| +++ b/codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java | |
| @@ -54,7 +54,11 @@ import io.netty.util.NetUtil; | |
| import java.net.InetSocketAddress; | |
| import java.util.List; | |
| import java.util.concurrent.CountDownLatch; | |
| +import java.util.concurrent.Executor; | |
| +import java.util.concurrent.TimeUnit; |
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
| // gcc callbench.c -o callbench -O1 | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include "cycle.h" | |
| int f0( int x ) | |
| { | |
| /* The details of this calculation are not important */ | |
| return x; | |
| } |
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
| #include <cstdio> | |
| #include <cstdlib> | |
| #include "cycle.h" | |
| const short NFUNCS = 24; | |
| template<int N> | |
| int fN(int x) { | |
| return fN<N-1>(fN<N-1>(x)); | |
| } |
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
| // print each byte from [begin, end) in groups of four per line | |
| void bindump(const uint8_t* begin, const uint8_t* end) { | |
| printf("BIN[%p, %p)\n", begin, end); | |
| char bytestr[9]; | |
| bytestr[8] = '\0'; | |
| for (uint8_t j = 1; begin != end; begin++, j++) { | |
| uint8_t byte = *begin; | |
| for (int i = 0; i < 8; i++) | |
| bytestr[i] = '0' + ((byte >> (7-i)) & 1); | |
| printf("%s%c", bytestr, j & 3 ? ' ' : '\n'); |
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
| // decompress a varint encoded integer | |
| uint64_t decompress(uint8_t* mem) { | |
| // mask to extract the msb of each individual byte | |
| static const uint64_t loMask = 0x8080808080808080; | |
| static const uint64_t decompMask[8] = {0x7F, 0x7F7F, | |
| 0x7F7F7F, 0x7F7F7F7F, | |
| 0x7F7F7F7F7F, 0x7F7F7F7F7F7F, | |
| 0x7F7F7F7F7F7F7F, 0x7F7F7F7F7F7F7F7F}; |
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 better.headers; | |
| import io.netty.handler.codec.AsciiString; | |
| import sun.misc.Unsafe; | |
| import java.lang.reflect.Field; | |
| public class Headers { | |
| private static final Unsafe theUnsafe; | |
| private static final int baseOffset; |
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
| Benchmark (keyDistribution) (mapType) (size) Mode Cnt Score Error Units | |
| IntObjectHashMapBenchmark.lookup HTTP2 AGRONA 10 thrpt 80 15615722.317 ± 76797.962 ops/s | |
| IntObjectHashMapBenchmark.lookup HTTP2 AGRONA 100 thrpt 80 1562510.865 ± 2332.439 ops/s | |
| IntObjectHashMapBenchmark.lookup HTTP2 AGRONA 1000 thrpt 80 120426.474 ± 2340.466 ops/s | |
| IntObjectHashMapBenchmark.lookup HTTP2 AGRONA 10000 thrpt 80 10760.255 ± 529.717 ops/s | |
| IntObjectHashMapBenchmark.lookup HTTP2 AGRONA 100000 thrpt 80 852.463 ± 1.554 ops/s | |
| IntObjectHashMapBenchmark.lookup HTTP2 AGRONA 1000000 thrpt 80 29.976 ± 0.400 ops/s | |
| IntObjectHashMapBenchmark.lookup HTTP2 AGRONA 10000000 thrpt 80 2.508 ± 0.028 ops/s | |
| IntObjectHashMapBenchmark.lookup HTTP2 NETTY 10 |